What are you expecting the "x:y" statement to do?  I ask because I'm not
familiar with that syntax, and ":" doesn't appear alone on any list of
operators I've seen.  Otherwise I only know it as the second operator of
the ternary operator ?:

In any case, what again are you trying to accomplish?  There's probably
a better way that doesn't have a syntax error.


On Thu, 2010-09-30 at 20:50 -0500, Anthony Ob wrote:
> ERROR
> 
> 
> Test6.rb:4 syntax error, unexpected tSYMBEG, expecting kDO or '<' or '<'
> e.times do+y:x|
> 
> test6.rb:5: syntax error, unexpected tSTRING_BEG, expecting kDO or '<'
> or '<'
>           puts "Looping #{y}"
> 
> test6.rb:7: syntax error, unexpected kEND, expecting $end]
> 
> ERROR
> 
> well here is the code
> 
> CODE
> 
> x = 1200
> puts "Before the loop, x = #{x}"
> 
> 3.times do|y:x|
>   puts "Looping #{y}"
>   x = y
> end
> 
> puts "After the loop, x = #{x}"
> 
> CODE