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?

28th Dec 2018, 1:40 PM
sky
sky - avatar
3 ответов
+ 9
break will work in else part also
28th Dec 2018, 2:38 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
28th Dec 2018, 2:55 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 4
I cant understand what you are telling. But I m sure it will stop the loop if the first if statement returns true.
28th Dec 2018, 1:49 PM
Seniru
Seniru - avatar