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..!!
1 Answer
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")