A
Albert Schlef
(I'm using Ruby 1.8.6.)
I'm trying to add a random number to an array. I do:
a = []
a << rand 3
But ruby replies with "syntax error, unexpected tINTEGER, expecting kDO
or '{' or '('"
Why's that?
When I add parentheses to the function call, as in...
a = []
a << rand(3)
...then I don't get this syntax error. I'd like to understand why this
happens.
I'm trying to add a random number to an array. I do:
a = []
a << rand 3
But ruby replies with "syntax error, unexpected tINTEGER, expecting kDO
or '{' or '('"
Why's that?
When I add parentheses to the function call, as in...
a = []
a << rand(3)
...then I don't get this syntax error. I'd like to understand why this
happens.