Q:

While loop assignment

# Finicky Counter
# Demonstrates the break and continue statements

count = 0
while True:
  count += 1
  # end loop if count greater than 10
  if count > 10:
   break
  # skip 5
  if count == 5:
    continue
  print(count)

input("\n\nPress the enter key to exit.")

Why does the while True loop apply to count in this circumstance? I dont understand why the boolean is gauging the result of count. Wouldn't the correct syntax be:
while count:

Any help clarifying this would be appreciated.

A:

It helps if you follow the code step-by-step in a debugger (a simple ide which allows this is PyScripter).
Just a few remarks:

while True is an endless loop. It can only be left by a break or return statement.
therefore the loop will run until the condition count > 10 is met. The break will terminate the loop and the next command (input ...) is executed.
if count == 5, continue tells python to jump immediately to the beginning of the loop without executing the following statement (therefore the "5" ist not printed).

But: follow the code in a debugger!

