DEV Community

Discussion on: Keeping your code clean by sweeping out "if" statements

Collapse
 
kaydubyew profile image
kaydubyew • Edited

I quite enjoyed this article.

While some may consider several years programming at university, then several more afterward, somewhat experienced, I consider myself a beginner. You can always be better.

Full disclosure I would have clung to the familiar if or switch approaches, that is until I read this article. There's always next time.

I like being able to look at my code and appreciate something well-crafted. It's a matter of personal bias, yes, but it's always helped me when reviewing code especially later.

I recently worked on a small project and would have really loved being able to clear up what was a nightmarish daisy chain of if-else statements.

I was able to clean it up quite well and eliminate many errors but I can see where it would have been great to use this approach. It would also make changing the values in a future version a snap.

In other words, thank you for helping a newbie see things in a different way.

Collapse
 
tomazfernandes profile image
Tomaz Lemos

Thank you for your feedback kaydubyew, I really appreciate it!