1

For the following method

def mixed_args(a,b,*c,d) 
  puts a,b,c,d
end
p mixed_args(1,2,3,4,5)

I get this error message:

syntax error, unexpected tIDENTIFIER, expecting tAMPER or '&'

Could you give me a hint what information I am missing?

sawa
  • 165,429
  • 45
  • 277
  • 381

1 Answers1

4

You're running Ruby 1.8. This "advanced" use of splats isn't available prior to 1.9.

In Ruby 1.8, the splat had to be the final argument: a,b,*c was fine. In Ruby 1.9 they introduced the ability to splat arguments mid-list, a,b,*c,d.

user229044
  • 232,980
  • 40
  • 330
  • 338