The * means that any further arguments are collected in an array. It lets
you handle an arbitrary number of arguments.
def test(*args)
args.length
end
test 'fish'
=> 1
test 'foo', 'bar'
=> 2
test
=> 0
test [1,2,3]
=> 1 #the array is one argument
test 1, 2, 3
=> 3
James Mason
Systems Administrator/Safety & Environmental Director
Yamato Engine Specialists
360-306-5017
On Wed, Sep 3, 2008 at 4:10 AM, luis tomas <[EMAIL PROTECTED]>wrote:
>
> Yo don't have to send parammeters in Rails (yo don't need). The
> parammeters are in params[:parammeter_name].
>
>
>
> On Aug 22, 12:44 am, miga <[EMAIL PROTECTED]> wrote:
> > On Aug 21, 10:31 am, Phoenix Nirvana <[EMAIL PROTECTED]> wrote:> def
> hello(*names)
> > > "The number of arguments is #{names.length}."
> > > end
> >
> > > I don't know the meaning "*" before "names" in line1
> >
> > See the explanation here: <http://www.ruby-doc.org/docs/
> > ProgrammingRuby/html/tut_containers.html> in Bloc transactions section.
> >
>
Confidentiality Notice:
The documents accompanying this electronic transmission may contain
confidential information. The information is intended only for the use of the
individual(s) or entity named above. If you are not the intended recipient, you
are notified that any disclosure, copying, distribution or taking of any action
in reliance on the contents of this electronic information is not permissible.
If you have received this electronic document in error, please immediately
notify us by telephone at (360)733-1916.
Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---