Is it better to wrap code into an ‘IF’ statement, or is it better to ‘short circuit’ the function and return? [closed]

Usually I have input-validation return right away. Imagine if you had a bunch of conditionals, you’d get a mess of nested ifs right away.

Generally once I get past input validation I avoid multiple returns, but for validation I return right away. Keeps it cleaner IMHO.

Leave a Comment