Question: Why this code doesn’t display “Found” if the value of the variable $log is 4797 ?
Not working
1 2 3 4 5 6 |
$log = 4797 switch ($log) { ((4797) -or (4672)){'Found'} } |
Working
1 2 3 4 5 6 7 8 9 |
# Answer: $log = 4797 switch ($log) { {$_ -eq 4797 -or $_ -eq 4672} {'Found'} } # Explanation: It is needed to use $_ in the switch statement. |