0
Can we use break in a exception block? if yes what happens to the flow? if no why not?
2 Respostas
0
break is used when loops are involved. Try and except blocks are not loops. Therefore, if you try to use this in the, python will likely spit a syntax error at you, aka, angry red text.
You're asking python to break out of an non-existent loop.
However, if your except blocks are inside a loop (or multiple), break can be used with exception blocks, and will exit/stop the innermost loop.
0
we can't use break keyword inside exception block, if you write break in exception then it will throws a syntax error.