r/ProgrammerHumor • • 10d ago

Meme thisIsWhyWeDontReturnInFinallyBlocks

Post image
3.0k Upvotes

100 comments sorted by

View all comments

Show parent comment

36

u/DebugDuck01 10d ago

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

6

u/friebel 10d ago

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

24

u/DebugDuck01 10d 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] 10d ago

[deleted] — view deleted comment

19

u/DebugDuck01 10d ago edited 10d 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 9d ago edited 9d 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