What is the idiomatic Go equivalent of C’s ternary operator?
As pointed out (and hopefully unsurprisingly), using if+else is indeed the idiomatic way to do conditionals in Go. In addition to the full blown var+if+else block of code, though, this spelling is also used often: index := val if val <= 0 { index = -val } and if you have a block of code … Read more