3 ms·
The main rationale for the lack of ternary, "We don't do control flow with symbols" should also disallow this: t && a() || b() Admittedly tho, nested tern
by networkimprov 8y ago
The main rationale for the lack of ternary, "We don't do control flow with symbols" should also disallow this:
t && a() || b()
Admittedly tho, nested ternaries are tedious to parse by eye.
- simonask 8y agoThey're nothing against nested applications of the above, though. :-) t && a() || (u && b() || c()) Personally, I enjoy Rust's choice of letting `if` be an expression.
- paulddraper 8y ago> I enjoy Rust's choice As a Scala user, I agree it really is the best val a = if (t) a() else b()
- lazarljubenovic 8y agoWe should also ban kitchen knives because users have repeatedly stabbed themselves in the eye.