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

1.22K views

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

In: 10

20 Answers

Anonymous 0 Comments

your program is “bring a forkful of food to my mouth” .. the exception is “food falls off fork in transit”. the food will land somewhere… but will it hit your plate? your napkin? your lap? your nice shirt? the floor?… the level of mess depends on what “catches” the food (exception). a try/catch puts a plate under your fork so the level of “mess” is minimal and you can keep eating.. not catching that exception means that your lap (or floor) catches it and you have to stop your program (eating) to clean up the mess…

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