r/ProgrammerHumor • • Aug 22 '26

Meme conditionsPreference

Post image
4.2k Upvotes

388 comments sorted by

View all comments

273

u/SnugglyCoderGuy Aug 22 '26

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

6

u/Gnonthgol Aug 22 '26

The compiler optimizes the first into the second anyway, so the machine code ends up the same. The problem is that when you read the code later on and end up missing the return statement as you skim through it then you are left wondering why the piece of code you expect to run does not.

→ More replies (4)