Else statements and early returns
January 3, 2020
The early return statement is useful. Indicating that there is no more processing increases readability significantly.
I think that the most readable approach is to have early return statements and else statements. The else statement highlights to the reader the alternative flow paths. The early return statements highlights to the reader the flow end.
This dual approach's greater readability outweighs the minor increase in duplication.