step(...) public

Iterates over rng, passing each nth element to the block. If the range contains numbers, n is added for each iteration. Otherwise step invokes succ to iterate through range elements. The following code uses class Xs, which is defined in the class-level documentation.

   range =
   range.step(2) {|x| puts x}
   range.step(3) {|x| puts x}


    1 x
    3 xxx
    5 xxxxx
    7 xxxxxxx
    9 xxxxxxxxx
    1 x
    4 xxxx
    7 xxxxxxx
   10 xxxxxxxxxx
Show source
Register or log in to add new notes.