Why doesn’t while True run forever?
If we didn’t increment and check the value of
count each time the loop runs, it would indeed run infinitely! In this code snippet, we wanted to enter the
while loop unconditionally, which is a common need!
Later you’ll learn about the
do-while loop, which is more suited for this kind of use, but for now, just know that you can have a loop that would run until some condition inside the loop is met, and then use
break to exit.