From: "Jan E." Date: 2012-06-14T18:39:09+09:00 Subject: Re: Simple method & array question Hi, Michael Sung wrote in post #1064551: > For example, I tried: > > def repeat *arg > repeated = *arg > p repeated > end Why are you using *arg? This will take all the arguments of the method call (there may be any number) and put them into an array, which is referenced by arg. For example: #------------------------- def f *args puts "args is #{args.inspect}" end f(1, 2, 3) # args is [1, 2, 3] f("a") # args is ["a"] f() # args is [] #------------------------- This is probably *not* what you want. You rather want the method to take a single argument (the array) and return this argument: #------------------------- def repeat array array end #------------------------- Of course this method doesn't make sense (and it works not only for arrays but every object). -- Posted via http://www.ruby-forum.com/.