Ruby Language For iterator


Example

This iterates from 4 to 13 (inclusive).

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

We can also iterate over arrays using for

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

for name in names
    puts name
end