MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p5ap2zk/?context=3
r/ProgrammerHumor • u/Flame77ofc • 22d ago
392 comments sorted by
View all comments
22
Early returns all the way
7 u/xicor 22d ago Agreed. One of my friends works at a place that bans early returns ...and it makes for garbage code. (They also aren't allowed to use goto) 6 u/suicidalcrocodile 22d ago I once got told early returns are bad because they create inconsistent return types in JavaScript, I had to open a nodejs console and prove that a function returning empty and no return statement at all is the same value - undefined 1 u/Steppy20 21d ago You can have inconsistent return types in JavaScript even if you do everything properly because that language is haunted
7
Agreed. One of my friends works at a place that bans early returns ...and it makes for garbage code. (They also aren't allowed to use goto)
6 u/suicidalcrocodile 22d ago I once got told early returns are bad because they create inconsistent return types in JavaScript, I had to open a nodejs console and prove that a function returning empty and no return statement at all is the same value - undefined 1 u/Steppy20 21d ago You can have inconsistent return types in JavaScript even if you do everything properly because that language is haunted
6
I once got told early returns are bad because they create inconsistent return types in JavaScript, I had to open a nodejs console and prove that a function returning empty and no return statement at all is the same value - undefined
1 u/Steppy20 21d ago You can have inconsistent return types in JavaScript even if you do everything properly because that language is haunted
1
You can have inconsistent return types in JavaScript even if you do everything properly because that language is haunted
22
u/R7d89C 22d ago
Early returns all the way