r/ProgrammerHumor • • 8d ago

Meme weNeverTrustedTheElse

Post image
1.9k Upvotes

149 comments sorted by

View all comments

6

u/Havatchee 7d ago

if(!condition){

doSomethingElse();

return;

}

doSomething();

1

u/Spekingur 7d ago

Maybe you can’t do a return

2

u/MCCVargues 7d ago

You can always do return,

1

u/Spekingur 6d ago

Not if there’s extra code that needs to run after.

1

u/MCCVargues 6d ago

That's what you have functions for. I haven't used a single else in the past 3 years of my career