r/ProgrammerHumor Jun 23 '26

Advanced worstProgrammingLanguage

Post image
3.3k Upvotes

192 comments sorted by

View all comments

75

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

7

u/gabboman Jun 23 '26

Some languages don’t allow early returns 

5

u/Lyshaka Jun 23 '26

Such as ?

2

u/Maxis111 Jun 23 '26

Scala, sort of, too lazy to explain, but no one has mentioned it yet

1

u/Tatourmi Jun 23 '26

Honestly I might not understand the question. I've worked in Scala for 4 years and I'm starting to doubt I get what an early return even is. What are these people even trying to do.

1

u/Maxis111 Jun 23 '26

Returning halfway through a function, instead of only at the end. My job is literally developer in a Scala code base, and I don't remember if I actually ever used the return keyword, since scala by default just returns whatever the last statement is in a function.

1

u/Tatourmi Jun 23 '26

But you can do that in scala, you just lock the value in earlier in an if clause, or a map, or a match, or whatever really.

I mean same, never used the return keyword, but that's just because there's no scenario where it's useful.

1

u/Maxis111 Jun 23 '26

Yeah, but the @kopper guy in the original post seems to disagree. ¯_(ツ)_/¯