Loops & Iterators

Looping with 'While'

Okay, training wheels off. Let's see your stuff!

i = 3
while i > 0 do
  print i
  i -= 1
  1. In the above example, we create a variable called i and set it to 3.
  2. Then, we print out 321 since we execute the loop as long as i is positive.
Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.