+ 1

Why/when did one needs to

raise an exception.

22nd Jan 2018, 6:26 AM
stephen haokip
stephen haokip - avatar
2 Answers
+ 2
when you want to make your code reusable, you raise exception to warn people using your code that there's a problem. a classic example is : you provide a divide fonction, and the user try to divide by zero ; in your function, you usually check that kind of problem and raise an exception if you find one
22nd Jan 2018, 7:36 AM
Vincent
Vincent - avatar
+ 2
thanks
22nd Jan 2018, 7:38 AM
stephen haokip
stephen haokip - avatar