Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > passing multi params

Reply
Thread Tools

passing multi params

 
 
Paul Vudmaska
Guest
Posts: n/a
 
      04-21-2004
How do I pass a varying number of parameters to an inner method?

def outer(first,*therest)
inner(therest)# pass all args to inner
end

Thanks for your help,Paul


 
Reply With Quote
 
 
 
 
Ryan Pavlik
Guest
Posts: n/a
 
      04-21-2004
On Thu, 22 Apr 2004 06:09:00 +0900
Paul Vudmaska <(E-Mail Removed)> wrote:

> How do I pass a varying number of parameters to an inner method?
>
> def outer(first,*therest)
> inner(therest)# pass all args to inner
> end


def outer(first, *args)
inner(*args)
end

> Thanks for your help,Paul
>



--
Ryan Pavlik <(E-Mail Removed)>

"Wow, I'm not dangerously incompetent!" - 8BT


 
Reply With Quote
 
 
 
 
Mark Sparshatt
Guest
Posts: n/a
 
      04-21-2004
Paul Vudmaska wrote:

> How do I pass a varying number of parameters to an inner method?
>
> def outer(first,*therest)
> inner(therest)# pass all args to inner


inner(*therest)

> end
>
> Thanks for your help,Paul
>

the * turns the array back into a parameter list

--
Mark Sparshatt



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LFSR calcs, passing params. Niv (KP) C Programming 3 05-16-2009 08:58 AM
FormView's ODS not passing correct insert params to BLL. How to debug this? bogdan ASP .Net 0 04-10-2008 12:23 PM
passing html params in Ruby joep Ruby 0 02-09-2007 06:17 PM
Passing POST params from one rhtml to another Belorion Ruby 1 02-09-2006 05:33 PM
params v.s. @params in rails? Barry Ruby 9 09-15-2005 03:12 AM



Advertisments