Hi --

On Sat, 25 Mar 2006, Axel Schlueter wrote:

> Hi,
>
> When reading somes ruby source I saw the
> *array_name notation, an asterisk in front
> of an array variables. I was unable to look
> up its meaning in the pickaxe. What exactly
> does the asterisk do to the array ? Any hints
> on where I can find a description in the
> pickaxe ?

The * is a "unary unarray" operator.  It "un-arrays" the array into a
list of separate values.

Thus, for example:

a = [4,5,6]
[1,2,3,*a]  => [1,2,3,4,5,6]

There are rules about where and when and how it can be used, but
that's basically what's happening when you see that.


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black