From: Robert Klemme Date: 2011-02-03T17:09:30+09:00 Subject: Re: For Loop with Steps? On Thu, Feb 3, 2011 at 6:58 AM, botp wrote: > On Thu, Feb 3, 2011 at 1:41 PM, Thescholar Thescholar > wrote: >> I am wondering how it's possible to iterate through a for loop statement >> by 5 rather than by 1. > > try this, > >  for i in (0..100).step(5) >    p i >  end > > > then compare this, > >  (0..100).step(5){|i| p i } There is also Fixnum#step irb(main):003:0> 0.step(100, 5) {|i| p i} 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 => 0 irb(main):004:0> Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/