http://qs1969.pair.com?node_id=587211


in reply to Precedence for Idiots

What I've attempted a few times, long ago before readability became important to me, is this:

$x ? $y = 1 : $z = 1;
That doesn't work, either. Parenthesis can help, of course. But that's not the right answer. The right answer is:
if ($x) { $y = 1; } else { $z = 1; }
Why? Because it's readable. If you're golfing, then maybe that's not what you want to hear. But for anything that needs maintenance, please consider this ;-)

(I'll echo BrowserUk's comments, though - a tutorial that moves someone from "initiate" to "novice" is sometimes more useful than moving someone from "novice" to "advanced"...)

Update: I stand corrected. jdporter's reply seems much more readable. <cough><cough>

*boggle*

(Yeah, I know, it was meant as a joke after my maintenance comment. At least, I *hope* it was a joke... ;->)