Hacker News new | past | comments | ask | show | jobs | submit login

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.



They'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.


> I enjoy Rust's choice

As a Scala user, I agree it really is the best

   val a = if (t) a() else b()




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: