this post was submitted on 30 Jun 2023
69 points (90.6% liked)

Programmer Humor

32070 readers
464 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 6 comments
sorted by: hot top controversial new old
[–] lowleveldata@programming.dev 14 points 1 year ago (1 children)

Why use goto when you can throw exceptions to escape nested for loops?

[–] fiah@discuss.tchncs.de 7 points 1 year ago (1 children)

exceptions are just fancy gotos

[–] wvenable@lemmy.ca 1 points 1 year ago

Exceptions are fancy returns. Everything else is fancy goto, including returns...

[–] HairHeel@programming.dev 2 points 1 year ago

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?

[–] speaker_hat@lemmy.one 1 points 1 year ago* (last edited 1 year ago)

Why throwing an exception without a message, when you can use 0/0