0
if 'break' takes effect, does it also work in 'else' statement in a while loop?
For example: while n < 3ïŒ if(xxxxxxx): expression1 break elif(xxxxxx): expression2 n+=1 else: Blabla If the first if statement return true, how about the else statement in the end of the code? The Blabla will be execute or not?
3 Answers
+ 9
break will work in else part also
+ 5
else is executed if loop is unbroken
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2487/
+ 4
I cant understand what you are telling. But I m sure it will stop the loop if the first if statement returns true.