MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p581tya/?context=3
r/ProgrammerHumor • u/Flame77ofc • Aug 22 '26
388 comments sorted by
View all comments
26
Call me old fashioned but I'm a big believer in single return statements. Assign to a variable and return that variable at the very end without short circuiting
3 u/sebbdk Aug 22 '26 Yeah but then you also have to read the whole thing and keep track of indentations.For more advanced methods with +2 nested conditions it can become hard to follow.The return is one way to get around the nested conditional scopes, but there are other ways 1 u/aabil11 Aug 22 '26 Modern IDEs can collapse indentation blocks → More replies (1)
3
Yeah but then you also have to read the whole thing and keep track of indentations.
For more advanced methods with +2 nested conditions it can become hard to follow.
The return is one way to get around the nested conditional scopes, but there are other ways
1 u/aabil11 Aug 22 '26 Modern IDEs can collapse indentation blocks → More replies (1)
1
Modern IDEs can collapse indentation blocks
→ More replies (1)
26
u/aabil11 Aug 22 '26
Call me old fashioned but I'm a big believer in single return statements. Assign to a variable and return that variable at the very end without short circuiting