0
[SOLVED] I'm learning while loop, and can someone tell me why the "break" statement isn't stoping the loop here?
3 Answers
+ 3
Line 8:
Use if instead of while
x = 1
while x>=1:
print(x)
x = x + 1
if x == 5:
print("breaking")
break
0
Vadivelan thanks, I tried if a bit but got some errors so I thought I wasn't doing it wrong but it's doesn't work that way