3 ms·
Instead of if expr { n = trueVal } else { n = falseVal } Just do n = expr !
by xyproto 14y ago
Instead of
if expr {
n = trueVal
} else {
n = falseVal
}
Just do
n = expr
!
- unwind 14y agoI think you're meant to read "trueVal" as "the value I want n to have if expr is true", not as literally true. And vice versa.
- jksmith 14y agoshould be easy enough to do a "choose" stmt in golang, stolen from a business lang called Clarion, but expanded to include closures: n = choose(expr,14,choose(expr2,15,some code that returns something))