Within a function, when you are done processing, i.e. the conditions are set, then return early. Don’t wait until the end of a function to return. Don’t wrap up your code in conditional expressions when you could have just returned early if the conditions were not met. Why? It makes your code hard to read.
The guideline is this:
When done, return. Otherwise, continue processing.
Did you learn something new? Share your thoughts.