The point of formatting one's code is to make the meaning clear to the reader. This reader finds:
I *think* I know what the second line does, but I'm not 100% sure. Blame my 15 years of programming in C, but I have to use brackets when I write a return statement. If that means I'm writing C in Perl, so be it.return ( ( $status == 0 ) ? 0 : 1 ); # Readable, clear. return $status == 0 ? 0 : 1; # Confusing. Precedence?
I also like to put brackets around a conditional, to highlight that there's a logic test going on. I know that operator precedence will take care of it without brackets, but why strain my brain.
Really, this is a tempest in a teapot. My Dad had a wonderful sentence that he claimed made sense, if only it were punctuated correctly: Smith, where Jones had had had had had had had had had had had the examiner's approval. Perfectly understandable: no punctuation is necessary, is it?
--t. alex
but my friends call me T.
In reply to Re(3): variable set to 0 ? 0 : 1
by talexb
in thread variable set to 0 ? 0 : 1
by c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |