in reply to Re: long if statements... What's the best way?
in thread long if statements... What's the best way?
Using the double pipe ("||") already short circuits testing. In this expression:
( $var eq 'a' || $var eq 'b' || $var eq 'c' )
...If it turns out that $var eq 'a', the other two conditions are not checked. If $var eq 'b', then only the first two conditions will be checked and not the third.
Moreover, it does not appear that the OP wants to take different actions for the different values, so having separate blocks for each value found doesn't make sense.
|
|---|