Why use goto when you can throw exceptions to escape nested for loops?
this post was submitted on 30 Jun 2023
67 points (90.4% liked)
Programmer Humor
33722 readers
450 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...
Why use try/if/catch when you can use try/if/switch/catch?
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 throwing an exception without a message, when you can use 0/0