News for hackers. Stuff that matters.
Re:Early exit is a tail call optimization of procedural lang... by glastra on Monday December 14, 2015 @11:47AM (#10732102)
> Early returns reduce the complexity of a method by reducing the number of possible states as you move through the method.

As I said in other comments, early returns for exceptions and bad input are fine. They are exceptions, though, not return statements. Go ahead and use return if you want/can, although I wouldn't.

If it's not for an exception or input validation failure, then we have something like:

"Alright, so here we do this, unless this, that and that other condition over there were true earlier, because the method would've returned then..."

I find that the complexity to keep track of with this approach is pretty much the same, or even more depending on the branching.

There are no comments on this comment yet.