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, ' '


10 11 12 13 14 15
Show source
Register or log in to add new notes.