For loop decrementing?

the incrementing for loop :

for i in 0…100
p i
end

gets 0 …> 100

is their a syntax for a decrementing one like :

for i in 100…0 (specifing the step to -1)
p i
end

100.downto(0) { |i|
p i
}

jogloran [email protected] wrote:

100.downto(0) { |i|
p i
}

thanks a lot !!!

Plug! http://code.eachmapinject.com/for_.rb
:slight_smile:

j`ey
http://www.eachmapinject.com