From: Dominic Son Date: 2006-09-20T05:48:11+09:00 Subject: Re: => A newb question Thanks for the clarification. I feel like an enlightened newbie right now. John Gabriele wrote: > On 9/19/06, Dominic Son wrote: >> why did matz choose to use '=>' to declare things instead of just making >> them all '=' ? > > '=>' isn't for assignment, per se. It's the syntax you use when defining > a hash: > > irb(main):001:0> h = {'foo' => 3, 'bar' => 1.05457e-34} > => {"foo"=>3, "bar"=>1.05457e-34} > irb(main):002:0> h['bar'] > => 1.05457e-34 > >> he cut our time marginally by letting us not put a ';' at the end of a >> line, but now we have to put a '>' with '='... > > Not sure what you're talking about there. > >> (i'm gonna guess a = operator is for assigning a value, whereas a => is >> for assigning symbols? ) > > Well, I guess with "=>", you're assigning a value to a key in a hash. :) > > Remember, when you're passing a hash into a method you may often omit > the curlies. > > ---John -- Posted via http://www.ruby-forum.com/.