DEV Community

Discussion on: If/else or just if?

Collapse
 
dvddpl profile image
Davide de Paolis

I'd definitely go for early returns.
less indentation, the logical steps are easier to follow, less code to read when you navigate through breakpoints while debugging.
also easier to further refactor if the single if statements get too long or complicated -> just move them to another function, which by the way would be unit-testable too.