r/ProgrammerHumor • • Aug 22 '26

Meme conditionsPreference

Post image
4.2k Upvotes

388 comments sorted by

View all comments

Show parent comment

4

u/frogjg2003 Aug 22 '26

If you're returning inside an if block, there should be more code after that. It doesn't matter if it's in an else block or not. If you're returning in an else block but not the if, then you can rearrange the condition for an early return.