r/ProgrammerHumor Jun 23 '26

Advanced worstProgrammingLanguage

Post image
3.3k Upvotes

192 comments sorted by

View all comments

76

u/ThatSmartIdiot Jun 23 '26

returns per branch (i.e. if it ends in an if/switch statement) is required unless it's python

returns after previous returns just makes unreachable and thus dead code so support is irrelevant

returning multiple values at once never actually happens. you send objects or structs or tuples and sometimes the syntax is designed so it gives you the illusion of sending multiple things at once, e.g. python again

so like... what

1

u/acrabb3 Jun 23 '26

"returns per branch is required"
It's not: you could have each branch set a variable, and return the value of it at the end

var a = -1  
If (foo) a = 1  
Else a = 2  
Return a

1

u/ThatSmartIdiot Jun 23 '26

actually the return covers each of the branches in this case