[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

What is this syntax?

David Corbin

2/13/2005 5:43:00 PM

def foo(*)
end

What does the "*" mean?


3 Answers

Robert Klemme

2/13/2005 5:53:00 PM

0


"David Corbin" <dcorbin@machturtle.com> schrieb im Newsbeitrag
news:200502131241.13403.dcorbin@machturtle.com...
> def foo(*)
> end
>
> What does the "*" mean?
>
>
Any number of arguments

> def foo(*) end
> nil
> foo 1
> nil
> foo
> nil
> foo 1,2,3
> nil

Kind regards

robert

David Corbin

2/13/2005 9:43:00 PM

0

On Sunday 13 February 2005 12:54 pm, Robert Klemme wrote:
> "David Corbin" <dcorbin@machturtle.com> schrieb im Newsbeitrag
> news:200502131241.13403.dcorbin@machturtle.com...
>
> > def foo(*)
> > end
> >
> > What does the "*" mean?
>
> Any number of arguments

And the foo method just can't refer to them?



Hal E. Fulton

2/13/2005 9:46:00 PM

0

David Corbin wrote:
> On Sunday 13 February 2005 12:54 pm, Robert Klemme wrote:
>
>>"David Corbin" <dcorbin@machturtle.com> schrieb im Newsbeitrag
>>news:200502131241.13403.dcorbin@machturtle.com...
>>
>>
>>>def foo(*)
>>>end
>>>
>>>What does the "*" mean?
>>
>>Any number of arguments
>
>
> And the foo method just can't refer to them?
>

Right... I'd assume it's for some kind of case where you're
stubbing something and you want to prevent an undefined
method but you don't really care about the parameters.

Hal