With this
return $a and not $b
The return happens first, and regardless of the value of $a. The rest of the line is therefore never even considered.
With this: $a and not $b the and is evaluated first, then the not $b if $a is false; then whatever is the result of that is returned by virtue of 'falling off the end' of the subroutine.
You might use return $a && !$b instead.
In reply to Re: To return and/or not?
by BrowserUk
in thread To return and/or not?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |