in reply to Complex conditional statements
Yes, you can get it all into one statement, but I think that ikegami's answer is much more legible, easier to understand, and thus, easier to maintain.
But based on the order of precedence from ikegami:
if (not B) { A } else { if (E and F) { C and D } else { undef } }
You could use:
( ! B ) ? A : ( ( E and F ) ? ( C and D ) : undef );or for legibility:
(! B ) ? A :( (E and F) ? (C and D) : undef );
or the completely horrible line noise:
!B?A:E&&F?C&&D:undef;
|
|---|