Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

newbie question

0 views
Skip to first unread message

cmic

unread,
Nov 22, 2009, 9:55:55 AM11/22/09
to
Hello

I noticed the following example somewhere

def mymethod(opts)
p opts
end
mymethod(:aaa => "something")

I'm wondering what this :aaa stands for. If I omit the
colon before the dummy aaa, it doesn't works.

Thanks for any hint/light.
--
michel marcon (aka cmic)
sysadmin

Luis Lavena

unread,
Nov 22, 2009, 10:12:43 AM11/22/09
to
On Nov 22, 11:55 am, cmic <c...@live.fr> wrote:
> Hello
>
> I noticed the following example somewhere
>
> def mymethod(opts)
> p opts
> end
> mymethod(:aaa => "something")
>
> I'm wondering what this :aaa stands for. If I omit the
> colon before the dummy aaa, it doesn't works.
>

Is because 'aaa' is undefined, while :aaa is a symbol

Get a free PDF version of The Book of Ruby to learn more about Ruby
syntax:

http://www.sapphiresteel.com/The-Book-Of-Ruby

--
Luis Lavena

0 new messages