From: Bertram Scharpf Date: 2009-02-13T02:22:13+09:00 Subject: Re: * before string Hi, Am Freitag, 13. Feb 2009, 01:51:24 +0900 schrieb Jonatas Paganini: > class NamedArg > def initialize(s) > @name, @type = *s.split(':') > end > end > > Why and where use * before string? Actually, you use the asterisk in front of an array. The asterisk makes the array to a list of arguments. Examples: ary.push [ :a, :b] # pushes an array ary.push *[ :a, :b] # pushes two symbols You may even do this: done = %(exit quit bye) case str.downcase when *done then return end In your example, the conversion will be done automatically when the right side is an array. When I code, I write the asterisk explicitly every time to remind myself what I meant. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de