downto

int.downto(limit) {|i| block } â self
int.downto(limit) â an_enumerator
Instance Public methods

Iterates block, passing decreasing values from int down to and including limit.

If no block is given, an enumerator is returned instead.

5.downto(1) { |n| print n, ".. " }
print "  Liftoff!\n"

produces:

5.. 4.. 3.. 2.. 1..   Liftoff!
doc_ruby_on_rails
2015-05-16 06:52:28
Comments
Leave a Comment

Please login to continue.