Hi --

On Thu, 2 Mar 2006, Jeff Cohen wrote:

> unknown wrote:
>> Quoting Jeff Cohen <cohen.jeff / gmail.com>:
>>
>> Assignments are legal in most places that => is; would you want to
>> trade one for the other?
>>
>> -mental
>
> Really?  This works for me:
>
>  h = { 'a' => 5, 'b' => 6 }
>
> but this gives my syntax errors:
>
>  h = { 'a' = 5, 'b' = 6 }
>
> test.rb:1: odd number list for Hash
> h = { 'a' = 5, 'b' = 6 }
>           ^
> test.rb:1: syntax error
> h = { 'a' = 5, 'b' = 6 }

No one said *illegal* assignments were allowed :-)

But consider this:

h = { a = 5, b = 6 }  # {5 => 6}


David

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

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