4 ms·
To be honest, I think nested conditionals of that form are hard to read whether you write them as if/else blocks or ternary expressions :) I'd first look for a
by tripzilch 9y ago
To be honest, I think nested conditionals of that form are hard to read whether you write them as if/else blocks or ternary expressions :)
I'd first look for a way to try and avoid the whole situation, if possible.
After that, what I feel is more readable depends on what formatting the language allows, length of identifier names, what the subexpressions look like, etc.
Then, after careful consideration, I'll just follow any style guide and thus prefer if/else blocks, especially if a ternary would silently discard its result.