Y
Hacker News
new
|
ask
|
show
|
jobs
by
saturncoleus
3695 days ago
If you don't care about side effects:
C:
int foo = bar ? 2 : 4;
Go:
foo := map[bool]int{true:2, false:4}[bar]
Python had a similar trick before 2.5 added ternary conditionals.