Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Loops & Iterators

The 'Until' Loop

The complement to the while loop is the until loop. It's sort of like a backward while:

i = 0 until i == 6 i = i + 1 end puts i
  1. In the example above, we first create a variable i and set it to 0 (zero).
  2. Then we execute a block of code until i is equal to 6. That block of code increments i.
  3. When i is equal to 6, the block ends.
  4. Finally, we print 6, the value of i, to the console.
Report a Bug
If you see a bug or any other issue with this page, please report it here.