DEV Community

loading...

Discussion on: Write better code and be a better programmer by NEVER USING ELSE statements

bernardwiesner profile image
Bernard Wiesner

Things you say like "I have been programming for 23 years" does not give you more credibility. Some people stay stuck and just do the same old thing without advancing, even for decades.

I agree 'else' has some use cases, but it makes your code much easier to read after you get used to not using 'else'. It also helps dealing with complex logic and reasoning about it, not having to deal with multi level nesting.

You should give it a shot after 23 years and try to stop using else. If after a week you still really dont like it you can always go back.

Thread Thread
stcinematicapp profile image
Studio Cinematic

You simply don't get it - saying "else" has some use cases - where do you people come up with this stuff. You really think I'm gonna give up using "else" based on someone's opinion? No thanks. I simply go with "else is a tool in the programmer's box, I use it when it makes sense". I don't deal in absolutes.

But yeah, feel free to stop using else, and then maybe after 5 years, re-read your code AND try to maintain it. Then we'll talk.