I am new to ruby and loving it so far and have beginner’s questions
I wanted something like this:
for (int i = 1; i <= 5; i++)
I wrote this:
i = 5
I am guessing that there is an internal variable that is incremented.
doh! Is there a way to get the changing variable in there without
having a separate variable in there?
Anyway, I then tried this:
for i in 1…5
Which worked as expected. But I had better use for a descending loop.
In pascal it would be
for i := 5 downto 1 do
but I could not figure out how to do that in a for loop. I looked
through several books and could not find the answer. Any tips?