News for hackers. Stuff that matters.
Re:Go 1.18 by orangecat on Tuesday March 15, 2022 @07:27PM (#30693309)
The if-else form, although longer, is unquestionably clearer.

I disagree:

- The variable name is repeated three times, increasing visual clutter and the chance of typos.

- The variable can't declared immutable. In Java/JS/Dart/etc it's nice to know that after "const x = foo ? bar : baz", x won't change.

And you don't even have to add a new operator, Rust and Kotlin get these benefits with an expression form of if/else.

There are no comments on this comment yet.