So a few days ago I decided I would try and learn Ruby and it\'s actually been going pretty well. I\'ve been mostly fiddling around in IRB until I can find a non-trivial pr
Unless your purpose is specifically to understand how while loops and integer addition/comparison work, what you really want is
1000.times do |i|
end
Ruby doesn't have C-style increment (++
) or decrement (--
) operators. You want this:
i = 0
while(i < 1000)
i = i + 1 # Or i += 1
end
i++
is not valid ruby. You need to do i += 1
.
Edit: See Mladen's comment as to what the parser is seeing.