method

each

v1_9_3_392 - Show latest stable - Class: Range
each()
public

Iterates over the elements rng, passing each in turn to the block. You can only iterate if the start object of the range supports the succ method (which means that you can’t iterate over ranges of Float objects).

If no block is given, an enumerator is returned instead.

(10..15).each do |n|
   print n, ' '
end

produces:

10 11 12 13 14 15