From: Jun Young Kim Date: 2009-01-08T20:53:34+09:00 Subject: Re: Can you guess what it will be happened? thanks for all your replies. 2009. 01. 08, 오후 8:46, Eustáquio Rangel 작성: > Hi! > > 2009/1/8 Jun Young Kim : >> what's the definition of '*'? >> is this pointer? > > It's called "splat operator". You can use it to "explode" your array > elements or join some variables on an array. Note the difference: > > irb(main):001:0> a = [1,2]; b = [3,4] > => [3, 4] > irb(main):002:0> a.push(b) > => [1, 2, [3, 4]] > irb(main):003:0> a.push(*b) > => [1, 2, [3, 4], 3, 4] > > And now: > > irb(main):004:0> def test(*args) > irb(main):005:1> p args > irb(main):006:1> end > => nil > irb(main):007:0> test(1) > [1] > => nil > irb(main):008:0> test(1,2,3) > [1, 2, 3] > > Regards, > >