4 ms·
Or make if… an expression instead of a statement. Go core are very smart people so I’m sure they have their reasons, but my Lisp-addled brain can’t understand
by User23 5y ago
Or make if… an expression instead of a statement.
Go core are very smart people so I’m sure they have their reasons, but my Lisp-addled brain can’t understand why you’d ever want statements instead of expressions with potentially discarded values.
- dontlaugh 5y agoWorks great in Rust, but almost everything is an expression there. I sadly don’t see it getting added to Go.
- lamontcg 5y agoRuby as well
- ts4z 5y agoI agree with this. The limited location I find that I really miss ternary operations is initialization. v := if foo() { 7 } else { 11 } But this means {} blocks now have values, which is weird in a C derivative. Of course, one could do v := func() int { if foo() { return 7 } else { return 11 } }() but... that's kind of awful.