+ 1

Can you use the raise statement outside the except block?

[ YES ] | [ NO ]

10th Sep 2020, 10:28 AM
Med Oubarka
Med Oubarka - avatar
4 Answers
+ 1
you have to write an exception after raise, for example: raise ZeroDivisionError you can also include some kinda message to show with that error: raise IndexError('custom message here')
10th Sep 2020, 11:07 AM
Bagon
Bagon - avatar
+ 1
of course, you can use it anywhere
10th Sep 2020, 10:29 AM
Bagon
Bagon - avatar
+ 1
so, ... this code is True !? # ~ try: print( 32 / 0 ) except: print("#Error") raise # ~
10th Sep 2020, 10:46 AM
Med Oubarka
Med Oubarka - avatar
+ 1
thanks Bro.
10th Sep 2020, 11:11 AM
Med Oubarka
Med Oubarka - avatar