P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
take advantage of the fact that the ternary operator has a return valueHow true; Perl is a bit unorthogonal in this respect, in that there is (at least) one case where you can achieve this effect with a plain 'if':
Some languages (old examples: Algol60 and Algol68) are more regular in this respect... BTW, does someone know by chance which was the first language which used ?: to represent "ternary if"? Of course you had this already in LISP or BCPL, but with a different syntax. The earliest occurance of ?: I know of, is in C, but I wouldn't be surprised if it was used in even older languages already.
-- Ronald Fischer <ynnor@mm.st> In reply to Re^3: "x ? y : z" notation
by rovf
|
|