DEMO: Let's learn how to create a loop that can run for an indeterminate amount of times!

A while loop is type of loop that repeats a code block as long as the loop condition remains True!

  • Click Run to see the parts of a while loop. Follow along to learn about while loops!
  • When the demo is done, the code in the code editor will run so you can have a change to guess!
  • Which guesses cause the loop to repeat? Which guess causes the loop to end?

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)