Why does this throw a syntax error? I would expect it to be the other way around...
>> foo = 5 >> foo = foo++ + ++foo
Ruby does not support this syntax. Use i+=1 instead.
i+=1
As @Dylan mentioned, Ruby is reading your code as foo + (+(+(+(+foo)))). Basically it's reading all the + signs (after the first one) as marking the integer positive.
foo + (+(+(+(+foo))))
+