get it on google playCreated with Sketch.
Python> While loop

While loop

Using a while loop to repeat lines of code starts with the while keyword.

while True:
  print("and again")

A while loop repeats its code block while its condition is True. We code a True condition with True followed by a colon :.

while True:
  print("and again")

The code the while loop repeats comes after the :, inside the indented code block. Like the print() statement here.

while True: 
  print("and again")

If a while loop's condition stays True forever, we call it an infinite loop since it will loop infinitely, like with print() here.

while True: 
  print("and again")
TRY IT ON THE APP