Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on If-else vs switch – Which is better?. Parent comment
For the special case of sequential numerical choices, a list works as well.
For the special-special case of numerical choices for single-word string outcomes, I often use:
dir = 'north eash south west'.split()[n]
There are no comments on this comment yet.
For the special case of sequential numerical choices, a list works as well.
For the special-special case of numerical choices for single-word string outcomes, I often use: