On Sat, Jul 28, 2001 at 04:34:46PM +0300, raptor wrote:
> if (cond)
> { }
> else {}
> otherwise {}
> 
> 
> i.e.
> if cond == 1  then  'then-block'
> if cond == 0  then  'else-block'
> if cond == -1  then  'otherwise-block'

Sounds like you need a switch, yes.  The cases where "cond" will
be 1, 0 and -1 is fairly rare in Perl and is pretty much limited
to cmp and <=>.

I'm curious to see examples of existing code which otherwise would
improve, but it really doesn't seem like there's much improvement
either way and you severely complicate the meaning of C<if( cond )>,
since it has to now fail on -1 if C<otherwise> exists.


PS  -1 is true, just to make sure that's clear.

-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
Hold on while I slip into something a little more naked.

Reply via email to