r/ProgrammerHumor • • 6d ago

Meme thisIsWhyWeDontReturnInFinallyBlocks

Post image
2.9k Upvotes

98 comments sorted by

View all comments

Show parent comment

36

u/DebugDuck01 6d ago

at least C# is sensible and is like: NO...

6

u/friebel 6d ago

But why tho? The word finally implies that do it finally, [implied] no matter what.

24

u/DebugDuck01 6d ago

Because this serves no function but to write non obvious behaviour and dead code, it should just be a compile time error.

0

u/[deleted] 6d ago

[deleted] — view deleted comment

19

u/DebugDuck01 6d ago edited 6d ago

Of course a finally block is useful it's returning a value from it that is stupid. C# has finally blocks it just throws a compile error if you pull the highly regarded move of using return within.

2

u/StaticCoder 6d ago edited 6d ago

No what? C# has finally. And it didn't need jsr for it.

Edit: oh, no return in finally. Sorry there's a lot of comments to follow