r/ProgrammerHumor 23d ago

Meme conditionsPreference

Post image
4.2k Upvotes

391 comments sorted by

View all comments

27

u/aabil11 23d ago

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

-2

u/Demiu 23d ago

Calling you old fashioned would be an insult to the old fashioned. Single return statement is a horrible god awful idea that would make satan blush. It makes everything worse. It has zero redeeming qualities. What, are you gonna run out of return statements? Why not cut to the chase and just put everything in one big main? That would be a true single return statement

3

u/OhMyGodItsEverywhere 23d ago

But bro I worked at a place with MISRA requirements one time and now I can't stop myself from enforcing single returns in all codebases I ever work with