Why use goto when you can throw exceptions to escape nested for loops?
this post was submitted on 30 Jun 2023
64 points (91.0% liked)
Programmer Humor
32448 readers
959 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
exceptions are just fancy gotos
Exceptions are fancy returns. Everything else is fancy goto, including returns...
I don’t see a catch
in the screenshot. Maybe this block just has a finally
that cleans some things up before the exception is thrown?
Why use try/if/catch when you can use try/if/switch/catch?
Why throwing an exception without a message, when you can use 0/0