DEV Community

Discussion on: Stop using if else

Collapse
 
talr98 profile image
Tal Rofe

I don't think replacing "if"/"else if"/"else" conditions with yours is the best.
There is reason we use these known conditions nowadays. It is easy to read. But you are right, it is not always easy to read. I would replace your so-called bad code (the first one of-course) with code which uses only "if" conditions. There is no need to use "else if" when the "if" ones would execute "return" statements.

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