Hi,
I am brand new to ruby and liking it so far - particularly the watir
test libraries. I am comfortable with the Java for loop syntax (i=0,
i<4, i++) and haven't found something in ruby that feels as elegant,
particularly when I want to use an increasing value i within the loop.
Here's an example (with my limited ruby)
i=0
0.upto(3) do
puts 'try number ' + i.to_s
i = i+1 # is there a
more elegant way to do i++ ?
end
I am guessing that ruby provides a more elegant way to do the above. I
would love recommendations both on how to iterate when I want to use the
changing value of the iterator in the loop, and how in ruby to do i++.
Is there a way with upto() to use the current value during iteration? or
another iterator where that is possible without needing to define i
seperately?
Thanks in advance,
Jeff Fry