For iterator

suggest change

This iterates from 4 through 13.

for i in 4..13
  puts "this is number #{i}"
end

for does not start a new scope, so i is still visible after the loop.

for can also walk an array:

names = ['Siva', 'Charan', 'Naresh', 'Manish']

for name in names
    puts name
end

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents