in reply to Re: ternary operator ?
in thread ternary operator ?

I wouldn't say "execute", but rather "return". Why? Because it can also return lvalues. In ALGOL, one could do:
IF a THEN b ELSE c FI := IF d THEN e ELSE f FI;

which was great. You can do something like that in Perl using the ternary operator:

($a ? $b : $c) = ($d ? $e : $f);

You can't do that in C or Java without use much more code.

Abigail

Replies are listed 'Best First'.
Re: Re: ternary operator ?
by broquaint (Abbot) on Nov 29, 2002 at 10:42 UTC
    I wouldn't say "execute", but rather "return".
    So would I ;)
    It's essentially like a returning inline if statement.

    _________
    broquaint