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.

--

Software Engineer, ex-FAANG

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store