On Tue, Oct 20, 2009 at 1:14 PM, Jian Lin <blueskybreeze / gmail.com> wrote: > for i = 35 to 1 step -1 hmm if you modify the step var, the block would not loop 35 times, wc you ask in your op > ¨Âóïíåôèéî> next yours was a special case, so i was thinking something like, > class Fixnum > def countdown_by decrement = 1 > x = self > x.times do |y| > yield(x - decrement*y) > end > end > end > > 5.countdown_by {|x| puts x} 5 4 3 2 1 => 5 > 5.countdown_by(2) {|x| puts x} 5 3 1 -1 -3 => 5 kind regards -botp