"Shannon Fang" <xrfang / hotmail.com> writes:

> Tks. My thinking is: when I see :: in the program, I tried to search
> in the index of the help, but no reference, when I search for <<, it
> only say that it is a method of array, no reference to singleton class
> binded with object... Last time I tried to search for the keyword
> "in", but no information... I also wonder where in the document did it
> mention the use of #{...} to represent a variable in a string... In a
> word, I need INDEX.

I don't know if the Windows help version includes the index. If not,
there's always the paper copy...

> >It represents a literal of type symbol (page 207)
> The information on Page 207 does not answer my question of WHY we need
> symbol? What is it used FOR?

It's the _name_ of something.

When you say

  a = fred

You're assigning whatever object is referenced by the variable 'fred'
into the variable 'a'. When you instead say

  a = :fred

you're creating a Symbol object that references the name 'fred'. Why?
Most uses are fairly specialized, but the most common is

  attr_reader :my_attr

without the colon, you'd be creating an attribute reader based on the
contents of a variable called 'my_attr'. With it, you're creating on
with the name 'my_attr'.

Cheers


Dave