Ashley Moran
4/2/2006 2:42:00 PM
Hi
I must be doing something stoopid here. Can anyone explain why I get
an error on the last line of this irb session?
irb(main):014:0> def a(a=nil,*b)
irb(main):015:1> puts a.inspect
irb(main):016:1> puts b.inspect
irb(main):017:1> end
=> nil
irb(main):018:0> a(1 => "one", 2 => "two")
{1=>"one", 2=>"two"}
[]
=> nil
irb(main):019:0> a(1 => "one", 2 => "two", 1)
SyntaxError: compile error
(irb):19: parse error, unexpected ')', expecting tASSOC
from (irb):19
from :0
Surely the output should be
{1=>"one", 2=>"two"}
[1]
?
I tried the example in Pickaxe v2 (p349) and got a similar error.
Someone please slap my head for me :)
thanks
Ashley