For iterator
suggest changeThis 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents