passing multi params

Discussion in 'Ruby' started by Paul Vudmaska, Apr 21, 2004.

  1. 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
     
    Paul Vudmaska, Apr 21, 2004
    #1
    1. Advertising

  2. Paul Vudmaska

    Ryan Pavlik Guest

    On Thu, 22 Apr 2004 06:09:00 +0900
    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
    > end


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

    > Thanks for your help,Paul
    >



    --
    Ryan Pavlik <>

    "Wow, I'm not dangerously incompetent!" - 8BT
     
    Ryan Pavlik, Apr 21, 2004
    #2
    1. Advertising

  3. 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
     
    Mark Sparshatt, Apr 21, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bogdan
    Replies:
    0
    Views:
    417
    bogdan
    Apr 10, 2008
  2. Niv (KP)

    LFSR calcs, passing params.

    Niv (KP), May 13, 2009, in forum: C Programming
    Replies:
    3
    Views:
    614
    Barry Schwarz
    May 16, 2009
  3. Barry
    Replies:
    9
    Views:
    483
    Ara.T.Howard
    Sep 15, 2005
  4. Belorion
    Replies:
    1
    Views:
    172
    James Britt
    Feb 9, 2006
  5. joep
    Replies:
    0
    Views:
    118
Loading...

Share This Page