eli5: In programming, how does using “try and except/catch” blocks stop the program from crashing?

1.09K views

eli5: In programming, how does using “try and except/catch” blocks stop the program from crashing?

In: 10

20 Answers

Anonymous 0 Comments

If you really screw up at work, you might go to your boss for help. If he doesn’t know what to do, he asks his boss. So on and so forth until someone handles it or it gets to the CEO. When it gets to the CEO and he can’t handle it, he goes “We’re screwed shut the company down”. Your program just crashed.

Try catch is just “try this stuff, and if something goes wrong do this”.

You can also catch specific kinds of exceptions, like “I know how to handle this but if something else goes wrong I have to ask my boss”

You are viewing 1 out of 20 answers, click here to view all answers.