3 ms·
nested ternaries are the same as if-else-if continuations. You figure that out one time, and it's easy to parse forever after. The ternary operator in general
by bagacrap 14y ago
nested ternaries are the same as if-else-if continuations. You figure that out one time, and it's easy to parse forever after.
The ternary operator in general eases understanding because it extracts the common bit, i.e. "sides[i] =", meaning you don't have to carefully read the contents of each and every conditional block to verify nothing else is going on besides this one assignment.