while else

while-else.py


count=0

while count<5:
    if count ==1:
        break
    print(count)
    count+=1
else:
    print('If you exit with break, it will not be executed')

Recommended Posts

while else
while else block
while statement
2016-10-30 else for Python3> for:
[Introduction to Udemy Python3 + Application] 40.while else statement
For Else statement