DEV Community

Discussion on: Stop using if else

Collapse
 
phantas0s profile image
Matthieu Cneude

Ah! Sweet coding challenges. I still remember this CTO who wanted me to replace an if else statement using a strategy pattern... the code was 10 lines. How to introduce useless complexity 101.

using multiple if else statements chained together or big switch statements will make your code look very ugly, less readable and error prone.

Why? I mean if it's so ugly, less readable, and error prone, why so many programming language implement them?

Some comments have been hidden by the post's author - find out more