3 ms·
I personally find early returns to be easier to understand (I think of them as exit conditions) than nested if statements but to each their own.
by whoisthemachine 7y ago
I personally find early returns to be easier to understand (I think of them as exit conditions) than nested if statements but to each their own.
- duncanawoods 7y agoThere are definitely cases like pre-conditions and validation that are natural early exists. There are other situations where it would sound really off and confusing to phrase instructions for a human that way. Not an easy task for an automatic code-clean-up tool to discern!