From: Guest Date: 2006-04-21T07:02:57+09:00 Subject: Re: Optional Message Parameters? Nathan Olberding wrote: >> Use a hash: >> >> def do_this( args ) >> puts args[:opt2] >> end >> do_this :opt2=>"This" #=> This >> >> What you're doing now is assigning to opt2 then passing it: >> >> do_this(opt2="This") >> puts opt2 #=> "This" > > I understand that this will work, but seems so inelegant. Is it really > how this is supposed to be done? There are default values too: def do_this( opt1, opt2="" ) puts opt2 end If that's what you mean. -- Posted via http://www.ruby-forum.com/.