Both the Integer and Date classes have downto methods : downto « Statement « Ruby






Both the Integer and Date classes have downto methods


# String does not have a downto method. 
# Like upto, it uses a block.

5.downto(1) { |i| print i, " " } # => 5 4 3 2 1

 








Related examples in the same category

1.A downto iterator, which starts at a higher number and loops to a lower number.
2.number of minutes you want to count down.
3.downto method with integer
4.downto with block