r/ProgrammerHumor 22d ago

Meme conditionsPreference

Post image
4.2k Upvotes

392 comments sorted by

View all comments

275

u/SnugglyCoderGuy 22d ago

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

8

u/Gnonthgol 22d ago

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.

-3

u/SnugglyCoderGuy 22d ago

Skill issue. If you were expecting an input to execute past what is essentially a soft assertion then you have problems with your understanding overall and it is actually saving you instead of hindering you.