4 ms·
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.
by Vaskivo 11y ago
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;"