> def foo(a, b, c) > "a:#{a} b:#{b} c:#{c}" > end => nil > foo(1, 2, 3) => "a:1 b:2 c:3" > x = [4, 5, 6] => [4, 5, 6] > foo(x) ArgumentError: wrong number of arguments (1 for 3) > foo(*x) => "a:4 b:5 c:6" On 3/31/06, coachhilton / gmail.com <coachhilton / gmail.com> wrote: > Very cute. I hopped onto irb to check out what each step of > Hash[*keys.zip(vals).flatten] does (I'd not used zip nor flatten in > some time) and I can't quite figure out what function asterisk, ie, > *keys performs (leaving it out or executing *keys.zip(vals).flatten > results in a ruby error and I don't see an explanation of this use of * > in the nutshell book.) Can one of you enlighten me?