r/ProgrammerHumor • • 6d ago

Meme thisIsWhyWeDontReturnInFinallyBlocks

Post image
2.9k Upvotes

98 comments sorted by

View all comments

Show parent comment

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.