On Sat, 7 Nov 2009, Michael W. Ryder wrote: > Walton Hoops wrote: >>> -----Original Message----- >>> From: marnen / marnen.org [mailto:marnen / marnen.org] >>>>> Now consider the ruby way: >>>>> >>>>> 10.times do |i| >>>>> print "#{i}," >>>>> end >>>>> >>>>> Some length as the C code, but much more readable. Heck, it's >>>>> almost English! > > But if you wanted to do something like: > i = 10; > while (i > 0) > { > printf("%d/n", i--); > } > in Ruby you would have to do something like: > i = 10 > while (i > 0) > puts i > i -= 1 > end > As far as I can tell there is no way in Ruby to use .each or .times to go > backwards. While I realize this thread is about the ++ operator the -- > operator is complementary. > what about the downto method? Matt