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
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
}
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs