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:

founded 5 years ago
MODERATORS
 
top 6 comments
sorted by: hot top controversial new old
[–] lowleveldata@programming.dev 13 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 0 points 1 year ago* (last edited 1 year ago)

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