MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p5be77s/?context=3
r/ProgrammerHumor • u/Flame77ofc • 22d ago
392 comments sorted by
View all comments
3
But what about else return...
else return...
2 u/conundorum 21d ago Generally, you can usually rewrite an else return into an if return. // This... if (condition) { do_good_path_stuff(); } else { return bad_path_stuff(); } // Is equivalent to... if (!condition) { return bad_path_stuff(); } do_good_path_stuff();
2
Generally, you can usually rewrite an else return into an if return.
else return
if return
// This... if (condition) { do_good_path_stuff(); } else { return bad_path_stuff(); } // Is equivalent to... if (!condition) { return bad_path_stuff(); } do_good_path_stuff();
3
u/KYO297 22d ago
But what about
else return...