Why do we still need “break” to exit?


#1

I am confused about increment the value of count has caused “False” already. Why do we still need “break” to exit ?

TIA.


Why doesn’t while True run forever?
#2

please post your code and exercise url


#3

Link

count = 0

while True:
print count
count += 1
if count >= 10:
break


#4

If you wouldn’t use break, you have an infinity loop.

while True can never become false, so we need to break the loop


#5

Got it… Thank you!


#6