From: Jano Svitok Date: 2008-02-07T12:08:44+09:00 Subject: Re: how to put hash values in function On Feb 7, 2008 2:23 AM, shawn bright wrote: > Hey there, > > i have an example function from documentation. > > it looks like this > > do_something(SomeValue, 2 => 'value', 3 => 'value', 4 => 'value', > someVar, someOtherVar) This doesn't work in ruby 1.8 - the hash arguments must be the last ones (maybe there's an exception, but I don't remember now). > now if i have a hash that has more or less values than the 3 shown > above, how could i pass those to the function where the index => value > is placed into the function ? > > exp: > if i have myHash = {2 => 'value', 3 => 'value', 4 => 'value'} > > how could i put these values in the array ? If you call do_something(SomeValue, myHash) it's the same as do_something(SomeValue, 2 => 'value', 3 => 'value', 4 => 'value') you can check it yourself using > thanks > > sk > >