When is try and catch keywords used? Is it necessary? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

When is try and catch keywords used? Is it necessary?

If the code is right then does it mean that try and catch keywords aren't used?

6th May 2017, 10:49 AM
Fahmeen Mazhar
Fahmeen Mazhar - avatar
6 Answers
+ 17
I've got examples at the code playground which might be helpful for you: https://code.sololearn.com/cik0exIc05FE/?ref=app https://code.sololearn.com/cQVLlvKiWbiz/?ref=app
6th May 2017, 11:22 AM
Tashi N
Tashi N - avatar
+ 10
You're welcome ^^
6th May 2017, 2:52 PM
Tashi N
Tashi N - avatar
+ 4
when you have user input you have to verify that it has valid value so your code works properly. also when you calculate something you have to make sure that your code works well with the result.
6th May 2017, 11:00 AM
Mario L.
Mario L. - avatar
+ 4
Thank you so much.
6th May 2017, 1:06 PM
Fahmeen Mazhar
Fahmeen Mazhar - avatar
+ 1
To avoid the program to stop unexpectedly for some reasons
6th May 2017, 11:17 AM
Huzaifah Punjani
Huzaifah Punjani - avatar
0
your welcome
6th May 2017, 3:02 PM
Huzaifah Punjani
Huzaifah Punjani - avatar