Re:Early exit is a tail call optimization of procedural lang...
by Vaskivo on Monday December 14, 2015 @11:23AM
(#10731900)
I disagree.
The function signature should be explicit about what it does and returns. If it has a static/defined return type I know what I can expect from it. The function name should also be explicit about what it does and returns.
Scrolling down to the end just to see a 'return books' statement is usually useless.
If I need to read the whole function, I'd rather have early exits instead of nested ifs. It's easier to read because it follows the logic of "if (such and such condition): nothing else to do -> return;"
The function signature should be explicit about what it does and returns. If it has a static/defined return type I know what I can expect from it. The function name should also be explicit about what it does and returns.
Scrolling down to the end just to see a 'return books' statement is usually useless.
If I need to read the whole function, I'd rather have early exits instead of nested ifs. It's easier to read because it follows the logic of "if (such and such condition): nothing else to do -> return;"