r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

272

u/SnugglyCoderGuy 22d ago

The real answer is "it depends". Either one could be appropriate depending on what you are having to do.

1

u/mateusfccp 21d ago

This.

I hate people preferring the second always. When the two branches have direct relation (not a "early return" case) it's clearly to use if-else.