the middle line is the same asunless( state equals A ) { Take action1 } elsunless( state equals B ) { Take action2 } else { Take action3 }
I agree, don't do that. But not every chain of if/elses is a simple switch statement. I can be testing a number of variables or aspects of the total state, making successively tighter constraints. Think of an && chain with side-effects on each test.elsif (state != B) ...
In reply to Re: Re: if/unless and chaining
by John M. Dlugosz
in thread if/unless and chaining
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |