7 ms·
What's the advantage over JS's ternary operator?
by aiham 8y ago
What's the advantage over JS's ternary operator?
- pmarreck 8y agoI guess it depends on whether "if" is treated as an expression which returns a value, which I don't think is the case due to the fact that I don't think there is an implicit value return in JS (such as in Ruby; the final line in any scope is the value that scope returns; same as in Elixir)
- crooked-v 8y agoThe same pattern should be usable for things like switch statements.