in reply to Re: nested tabular ternary
in thread nested tabular ternary
Just an observation regards style. (And please don't get me wrong - this is just an observation, not a critisism - each to their own :)
I find it interesting that both yours and Liverpole's answer use a similar layout style for the ternary. That is - to break the line after an operator.
This of course goes against what is recommended by TheDamian in PBP (pp. 27-29 & 121-123). Personally, I prefer his recommended style, and I would have written your second example like so:
To me, this is more readable - it looks more like a "table", and it's more obvious that there is some nesting. Also, having an operator at the start of a line makes it much more obvious that it's a continuation of the previous line.$result = ($major_length == 4800) ? 18 : ($major_length == 8552) ? ($val == 4 ? 33 : $val == 1 ? 18 : die "not handled") : die "not handled";
Cheers,
Darren :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: nested tabular ternary
by diotalevi (Canon) on Apr 11, 2006 at 02:09 UTC | |
by McDarren (Abbot) on Apr 11, 2006 at 02:35 UTC | |
by diotalevi (Canon) on Apr 11, 2006 at 03:52 UTC | |
|
Re^3: nested tabular ternary
by ikegami (Patriarch) on Apr 11, 2006 at 02:22 UTC | |
by McDarren (Abbot) on Apr 11, 2006 at 03:03 UTC | |
by ikegami (Patriarch) on Apr 11, 2006 at 03:53 UTC |