5 ms·
JavaScript has something like that: let x = true ? "x" : "y"; // sets x to "x"
by mdwalters 3y ago
JavaScript has something like that:
let x = true ? "x" : "y"; // sets x to "x"
- tcbawo 3y agoC++ has ternary expressions as well. The author was proposing a change to if/else as a more readable alternative to the ternary symbols. IMO using something like: x = “x” unless(true) “y” Wouldn’t follow the usual left to right order of evaluation, but I think it’s a somewhat readable alternative.