R
RichardOnRails
In trying to understand the splat operator, I visited:
http://theplana.wordpress.com/2007/03/03/ruby-idioms-the-splat-operator/
The first example that site offers is:
The split mode :
pet1, pet2, pet3 = *["duck","dog","cat"]
That resulted in pet1 == "duck", etc
But so did:
pet1, pet2, pet3 = ["duck","dog","cat"] # no splat operator
and#
pet1, pet2, pet3 = "duck","dog","cat" # no array-literal markers
So this first example makes no sense, does it? What am I missing?
Thanks in Advance,
Richard
http://theplana.wordpress.com/2007/03/03/ruby-idioms-the-splat-operator/
The first example that site offers is:
The split mode :
pet1, pet2, pet3 = *["duck","dog","cat"]
That resulted in pet1 == "duck", etc
But so did:
pet1, pet2, pet3 = ["duck","dog","cat"] # no splat operator
and#
pet1, pet2, pet3 = "duck","dog","cat" # no array-literal markers
So this first example makes no sense, does it? What am I missing?
Thanks in Advance,
Richard