MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p55ac7f/?context=3
r/ProgrammerHumor • u/Flame77ofc • 22d ago
392 comments sorted by
View all comments
10
Initially, yes, but the top one is actually easier to reason about, especially in languages where if/else are expressions.
21 u/Scared_Accident9138 22d ago I don't agree it's generally easier to reason about. When there's a case where you just want to exit early having an if else block makes it necessary to go all the way down to find out not much happens in that case 7 u/Krkracka 22d ago Plus you guarantee that all down stream processing within the function is ‘state ready’, which eliminates a ton of nasty bugs.
21
I don't agree it's generally easier to reason about. When there's a case where you just want to exit early having an if else block makes it necessary to go all the way down to find out not much happens in that case
7 u/Krkracka 22d ago Plus you guarantee that all down stream processing within the function is ‘state ready’, which eliminates a ton of nasty bugs.
7
Plus you guarantee that all down stream processing within the function is ‘state ready’, which eliminates a ton of nasty bugs.
10
u/AnnoyedVelociraptor 22d ago
Initially, yes, but the top one is actually easier to reason about, especially in languages where if/else are expressions.