Variables starting with ":"

E

Eduardo Scoz

Hi guys,

I've been looking for information about this for a while on some ruby
books, and tutorials, but could never find anything.

What's the diference between regular variables defined as, lets say
"example", and the ones defined as ":example" ? If there's a difference,
when should each case be used?

In many examples, it's common to see code that uses variables with the
:, specially when defining arrays (like cookies[:user_id] = "abc")..

I'm sorry for the simple/stupid question.. I've been studying about ruby
only for the last week or so.

Thanks a lot!!

Eduardo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,222
Messages
2,571,138
Members
47,755
Latest member
Grazynkaa

Latest Threads

Top