Execution Flow - 9gix/9gix.github.io GitHub Wiki
DRAFT: (Opinion)
I have seen coders wrote a function/method with multiple return statement. I believe this is bad because the flow of execution returned in the middle of the program. It makes things harder to debug when logic error, because we are not sure at which return point the value came from. It also implies that your program has multiple cases of condition. This makes your function/method hard to test, because you need to permutate the combination for the function.
Instead of returning value, you should throw an exception in the middle of the program to replace return statement. Throw is a special kind of return which should be handled later.
So, in summary, we should have a function with only one return statement and could have multiple throw statement as its exception exit point.