in reply to Re^2: if/else syntax
in thread if/else syntax

(a?b:c) also has those problems right ?

No, because the ":" isn't optional like else is, and because people don't indent the conditional operator like they would an if/else.

It has a different problem, though. A frequent mistake with the conditional operator is to use it as follows:

$c ? $x = $i : $y = $j;
The above means
( $c ? $x = $i : $y ) = $j;
but people expect it to mean
$c ? ($x = $i) : ($y = $j);

Replies are listed 'Best First'.
Re^4: if/else syntax
by Anonymous Monk on Jun 26, 2009 at 17:05 UTC
    a thats true.
    indeed, the fact that ":" isn't optional changes everything, now it makes more sense. thanks.