Code Editor
Learn
Loops & Iterators

Looping with 'For'

In case you're not picking up on the theme of Ruby having a gajillion ways to do any given task: let's convert our loop yet again.

for k in 1..3 print k end

In the above example, we print out 123 by virtue of looping from 1 to 3 inclusive.

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.