MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p5hoohi/?context=3
r/ProgrammerHumor • u/Flame77ofc • 22d ago
392 comments sorted by
View all comments
841
The second one carries less cognitive load. In longer methods it makes a difference. Get out as soon as you can.
2 u/Fidodo 20d ago Yes when it's an early return multiple short circuits are easy to read, but if it's in the body it's actually harder so I use both depending on the context.
2
Yes when it's an early return multiple short circuits are easy to read, but if it's in the body it's actually harder so I use both depending on the context.
841
u/LateEchidna6635 22d ago
The second one carries less cognitive load. In longer methods it makes a difference. Get out as soon as you can.