4 ms·
In that sort of situation I would definitely prefer the ternary, although nesting them sans (redundant, but explicit) parenthesis isn't something I would do. I
by natesm 15y ago
In that sort of situation I would definitely prefer the ternary, although nesting them sans (redundant, but explicit) parenthesis isn't something I would do. I also like the somewhat Rubyesque one liners for simplistic if/else pairs.
I just didn't want to write a bunch of nonsense code as an example.