2 ms·
Nesting them is not so bad if the syntax makes it obvious what the precedence is, which isn't true of C, but is of Rust for example. Anyway, complicated code s
by School-Cotton 2y ago
Nesting them is not so bad if the syntax makes it obvious what the precedence is, which isn't true of C, but is of Rust for example.
Anyway, complicated code should be avoided whenever possible, true, but banning the ternary operator (and similar constructs like match/switch statements as expressions) does nothing to make code simpler. It just forces you to transform
let x = (some complicated nested expression);
into
var x;
// (some complicated nested tree of statements where `x` is set conditionally in several different places)