> -----Original Message-----
> From: Michael W. Ryder [mailto:_mwryder55 / gmail.com]
> 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.

Others have mentioned reverse each and downto, so I'll just throw in one
more. If you are determined to save that line, you also have:
(untested, so if I'm off my one, from the C feel free to tar and feather me)

i=11
while (i-=1) > 0
  puts i
end

or:

i=11;
while i > 0
  puts (i-=1)
end

I also think this demonstrates my previous point, that playing Perl golf
serves no one.  I've found it rare that saving a line at the cost of
readability improves code in any way.  If the interpreter is any good,
your 5 line example should execute just as fast as my 4 line, and it's
certainly much clearer what is actually being done.  I've seen plenty of
C programmers who really should know better, get confused by ++ in 
unexpected places.


What it all comes down to in my personal opinion (as no one of any real note)
is that while ++ can be a cool little operator, it really doesn't give enough
benefit to be worth the confusion involved in implementing it in Ruby.  It's
been made plenty clear by others why ++ would have to be a special case operator
in Ruby (as opposed to the other operators which are simple methods), but why
write special logic for this one silly operator that at BEST saves us one line
of code here and there?