Absolutely.
I once had to deal with code that did something like this:
return a ? b : c ? d : e ? f : g;
I'm not kidding.I once had to deal with code that did something like this:
return a ? b : c ? d : e ? f : g;
I'm not kidding. return a ? b :
c ? d :
e ? f :
g;
Side note: this does not work in PHP, as the operator is left-associative instead of right-associative there. The above in PHP would be evaluated as: return ((a ? b : c) ? d : e) ? f : g;
Which is almost never what you want. I can't even format this properly to convey intent.I would say it's a case-by-case statement. Well, okay, more specifically, I would say that the use of a single ternary if is a case-by-case statement.