3 ms·
This is called "early return" and the parent already mentioned it: > if you're gonna punt, early-return
by quietbritishjim 7y ago
This is called "early return" and the parent already mentioned it:
> if you're gonna punt, early-return
- afiori 7y agohere there is some significant restructuring of the flow control, early returns could have just meant return statements in the middle of the function.
- quietbritishjim 7y agoI'm really quite sure they were referring to the type of code in your comment. Early return on error (as in, what you posted) vs single return with deeply nested if statements is an absolutely classic coding debate.
- afiori 7y agojust as a quick clarification, I am not the OP
- quietbritishjim 7y agoOops, I did indeed miss that. I suppose that shows that it was helpful to spell it out.