So I'm iterating over a range like so:
(1..100).each do |n|
# n = 1
# n = 2
# n = 3
# n = 4
# n = 5
end
But what I'd like to do is iterate by 10's.
So in stead of increasing n
by 1, the next n
would actually be 10, then 20, 30, etc etc.
Best Answer
See http://ruby-doc.org/core/classes/Range.html#M000695 for the full API.
Basically you use the
step()
method. For example: