method
cycle

cycle(*args)
public
Calls the given block for each element n times or forever if nil is given.
Does nothing if a non-positive number is given or the array is empty.
Returns nil if the loop has finished without getting interrupted.
If no block is given, an Enumerator is returned instead.
a = ["a", "b", "c"] a.cycle {|x| puts x} # print, a, b, c, a, b, c,.. forever. a.cycle(2) {|x| puts x} # print, a, b, c, a, b, c.