this post was submitted on 13 Nov 2024
180 points (98.4% liked)

Programmer Humor

32472 readers
657 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] TimeSquirrel@kbin.melroy.org 8 points 1 day ago (5 children)

I'm just a hobbyist but...are you guys using exceptions like they're conditional statements?? I thought those were for only when shit is seriously wrong and execution can't continue in the current state. Like if some resource was in a bad state or some input was malformed.

Or maybe I haven't worked on anything complex enough, I dunno.

[โ€“] tunetardis@lemmy.ca 4 points 1 day ago

I suppose it depends on the language? For the most part I think you're right. Exceptions are only used (if at all) in situations where a program diverges unexpectedly from its normal flow. But take a language like Python. They're just everywhere. Even your plain old for loop ends on an exception, and that's just business as usual.

load more comments (4 replies)