Gary Wright
5/14/2008 7:33:00 PM
On May 14, 2008, at 3:20 PM, Jeff Hales wrote:
> Hi all. I'm just starting to learn Ruby and have hit a problem that is
> being extremely difficult to find information on. When given a line of
> code such as:
>
> a = "this", b = "that", c = "those"
This statement is parsed as:
a = [ "this", (b = "that"), (c = "those") ]
The right hand side of the assignment to variable 'a'
is an array of three items:
first item: a string with value "this"
second item: a string with value "that"
third item: a string with value "those"
As a side effect, the variable b is assigned to "that"
and the variable c is assigned to "those"
The example you gave is pretty unusual. I *think* you
were thinking about parallel assignment, which would
look like:
a, b, c = "this", "that", "those"
Gary Wright