Skip to main content

7.16) Never Ending Loops


If you don’t modify the counter within the loop, the test is always True, the loop will therefore be repeated infinitely. To stop an infinite loop type CTRL-c, it will escape the loop and return an error. Try it out yourself in IDLE:

counter=3
while counter <= 8:
    print 'execute the loop body'

Press return twice in IDLE to indicate the end of indentation.