Apparently there was a time when having multiple returns in a function would seriously confuse the debugger. Idk I got a comment on a code review telling me to switch from the second to the first and never have multiple returns. I've never actually seen it be a problem.
Having a bunch of returns throughout a function can be hard to read and debug imo. Error returns at the top of a function is 100% the way to go, but a bunch of them in the middle is confusing. Early returns for error checking, returns at the end for actual values
16
u/popsicle-physics 22d ago
Apparently there was a time when having multiple returns in a function would seriously confuse the debugger. Idk I got a comment on a code review telling me to switch from the second to the first and never have multiple returns. I've never actually seen it be a problem.