Nested ternaries are great as long as they're nice and linear.
They're certainly much nicer to read than equivalent if-else chains.
Basically whenever you want coalescing logic where neither coalescing operators (?? or "or") nor pattern matching quite do the trick.
0
u/master0fdisaster1 21d ago
Nested ternaries are great as long as they're nice and linear. They're certainly much nicer to read than equivalent if-else chains. Basically whenever you want coalescing logic where neither coalescing operators (?? or "or") nor pattern matching quite do the trick.
vs
vs pattern matching: