DEV Community

Discussion on: A simple tip for cleaner code

Collapse
 
toby profile image
toby

Possibly older devs write like this because other languages (mostly outside of web stack AFAIK) can consider that a single exit point is safer, same goes for making sure (generally speaking) any 'if' has an 'else'. For example see MISRA-C-2004.

Collapse
 
blackcat_dev profile image
Sasha Blagojevic

That makes sense, you're probably right.

Collapse
 
carterwickstrom profile image
Carter Wickstrom

It’s almost certainly this. It’s always good to question convention, but when all of the more experienced devs follow a pattern, there’s probably a reason for it. It’s unfortunate that none of the ones you work with were able to explain why, instead of just being annoyed.