Igor Petrov
Jun 15, 2022

--

In many cases you don't even need if-else or other branching at all. For instance, in your example with country codes, it's much simpler, especially in modern static type languages, to have a map <ContryCode, CountryName> and just use a simple plain get from map. Many languages have out of the box get-or-else, get-or-throw functionality.

--

--