0

Python break error

i=0 while 1==1: print(i) i=i+1 if i>=5: print("Breaking") break print("finished") why this code is showing error..!!

18th Jan 2018, 3:54 PM
Arya DRJ
Arya DRJ - avatar
1 Odpowiedź
0
The problem is that your if-structure isn't part of the while loop anymore because of the enter you put in between, try writing it like this i=0 while 1==1: print(i) i=i+1 if i>=5: print("Breaking") break print("finished")
18th Jan 2018, 4:12 PM
Jente