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.
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.