Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Array question
Peter Szinek
11/9/2006 1:01:00 PM
Hello,
I have a function like this:
def f(*args)
#do something
end
and I have an array, say
a = [1,2,3]
Now I would like to call f() with the contents of the array i.e.
f(1,2,3) in this case (i.e. not f([1,2,3]) )
What is the most Rubyish way to accomplish this?
TIA,
Peter
--
http://www.rubyra...
1 Answer
Farrel Lifson
11/9/2006 1:05:00 PM
0
On 09/11/06, Peter Szinek <peter@rubyrailways.com> wrote:
> Hello,
>
>
> I have a function like this:
>
> def f(*args)
> #do something
> end
>
> and I have an array, say
>
> a = [1,2,3]
>
> Now I would like to call f() with the contents of the array i.e.
>
> f(1,2,3) in this case (i.e. not f([1,2,3]) )
>
> What is the most Rubyish way to accomplish this?
>
> TIA,
> Peter
>
> --
>
http://www.rubyra...
>
>
f(*a)
Farrel
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Array question
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password