c/programmerhumor · by qaz@lemmy.world · 3yWhy use if/else when you can use try/if/catch? 85 points · 8 comments · view on lemmy.world
8 Comments
lowleveldata@programming.dev · 18 pts · 3y
Why use goto when you can throw exceptions to escape nested for loops?
fiah@discuss.tchncs.de · 9 pts · 3y
exceptions are just fancy gotos
wvenable@lemmy.ca · 1 pts · 3y
Exceptions are fancy returns. Everything else is fancy goto, including returns...
speaker_hat@lemmy.one · 3 pts · 3y
Why throwing an exception without a message, when you can use
0/0HairHeel@programming.dev · 2 pts · 3y
I don’t see a
catchin the screenshot. Maybe this block just has afinallythat cleans some things up before the exception is thrown?qaz@lemmy.world · 1 pts · 3y
It doesn't have a catch block, and it isn't supposed to throw any other exceptions inside the try block either.
cupcakezealot@lemmy.blahaj.zone · 2 pts · 3y
Why use try/if/catch when you can use try/if/switch/catch?