how can we use raise statement outside except block? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

how can we use raise statement outside except block?

29th Oct 2016, 2:20 PM
Harsh Shukla
Harsh Shukla - avatar
3 Answers
+ 5
you can ALWAYS use raise statement. if you catch it with a try/except block, the program will continue smoothly, if not, it terminates. there are two cases in which terminating is useful; 1- when you actually want to terminate the program. (ie. the user entered invalid input) 2- when you want to end a thread or a subprocess. a raise statement does not terminate the main or "mother" process but does terminate the thread or subprocess which may be what you want Have a nice day!
10th Nov 2016, 4:28 AM
Sinan Yumurtacı
Sinan Yumurtacı - avatar
+ 4
then the 3rd question is wrong.. I must answer yes to the question "can you use raise statement outside the except block"
31st Oct 2016, 9:57 AM
Yohanes Candrajaya
Yohanes Candrajaya - avatar
- 1
you must build your except block.
30th Oct 2016, 8:51 PM
Woramet Tps
Woramet Tps - avatar