in reply to Re: A new idiom -or- I Hate Unless
in thread A new idiom -or- I Hate Unless
Anyway, I still think unless is still much nicer than its slang equivalent, !if .
I have no problem with unless, but I cringe when I see it used as the block form. I find it interesting to note that perlsyn doesn't even bother mentioning it, so I'm surprised that it pops up so often.
It is mentioned in perlsyn (5.8.2), it's just easy to miss it:
from perlsyn(1): The following compound statements may be used to control flow: if (EXPR) BLOCK if (EXPR) BLOCK else BLOCK if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK ... The "if" statement is straightforward. Because BLOCKs are alwa +ys bounded by curly brackets, there is never any ambiguity about which "if" an "els +e" goes with. If you use "unless" in place of "if", the sense of the test is rev +ersed.
Btw, why isn't there an elsunless statement like if : unless = while : until = elsif : elsunless?
(Update: fixed /code tag)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: A new idiom -or- I Hate Unless
by BrowserUk (Patriarch) on Aug 23, 2004 at 09:23 UTC |