DEV Community

Discussion on: A simple tip for cleaner code

Collapse
 
alesisjoan profile image
Alesis Manzano • Edited

Option 1, one return at the end. Best for debugging.
Option 2: early returns. I consider valuable when you have a simple condition that could be evaluated at the beginning and the rest of conditions are more complex, so you can save some precious cpu time haha