Chris, I am not sure what you are trying to say, you’re mentioning early returns are bad and “} else {“ are also bad. So it’s quite unclear yet I get a aggressive tone from you as well.

That aside, I definitely love early returns for all the valid reasons. I have a mild dyslexia as well and early returns helps me crazily much. Early returns makes it a gazillion times easier to follow and understand the flow, compared to using “if/else“.

Nested functions/methods are horrible, mutating variables makes it difficult to track the current value of a variable.

Early returns combined with small functions following the single responsibility principle is wonderful. It makes everything easy to understand. On top of that, your code also becomes very flexible, robust and easy to refactor. Humans understand things sequentially, so its’ better if you code that way as well. Readability is to be prioritised.

M.sc in computer engineering, entrepreneur and fullstack developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store