Can anyone explain about "try"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can anyone explain about "try"?

Try and else

18th Apr 2019, 5:46 PM
Dileep Patcha
Dileep Patcha - avatar
5 Answers
+ 3
code stops running if it encounters an error. the try and except block is used to allow code to continue running if an error is encountered.
19th Apr 2019, 1:07 AM
Jim
+ 3
Try is usually coupled with catch, not else.
20th Apr 2019, 5:48 AM
Sonic
Sonic - avatar
+ 2
It's the entry point for error trapping code block, and is followed by an error handling code block, with or without error logging.
19th Apr 2019, 2:26 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
In short words this is part of handling exceptions. If something will fail in try block, code will go to catch block
18th Apr 2019, 9:08 PM
Tomasz Rudzki