Loops- While Loop


The syntax of a for loop is ideal when you know how many times you want a loop to run. What if we don’t know how many times a loop should run in advance? In situations when we want a loop to execute an undetermined number of times, while loops are a great choice. We start our loop with the keyword while followed by our stopping condition, or test condition. This will be evaluated before each round of the loop. While the condition evaluates to true, the block will continue to run. Once it evaluates to false the loop will stop. In the following video, we will show you how to write a while loop.


  1. Click the play button to watch the video lesson.
  2. Watch the lesson as many times as needed.
  3. Code along with the instructor using the integrated code editor in the center of your screen.
  4. You can use the Run button beneath the code editor to test your code.
  5. Output from the code that you have written will appear in the panel on the right side of your screen.

If you get stuck or need assistance, you can click the button below to connect with a tutor. 

For additional questions or technical support, email support@veroskills.com