Comment

Comment by saturncoleus

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.
parent saturncoleus 10 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton