It's actually a very good question. hashes are like arrays with non
numerical tags.

but instead of referring to the list as list[0] or list [2] you refer
to it as list[:element]

It's like having a readable array which also retains the speed.

for example of you have an array such as

a=3D[1,2,3]

you would get 2 by accessing via

a[1] (index starts at zero)

as a hash it could be written

a=3D{one: 1, two: 2, three: 3}

then to access 2 we can do

a[:two]

instead of

a[1]

btw I used the shorthand version of hash creation which drops the =3D>
and moves the colon to the other side of the key.

I hope I didn't confuse you more.

On Thu, Dec 9, 2010 at 2:08 AM, Soichi Ishida
<soujiro0725+rubyforum / gmail.com> wrote:
> Hi. =A0I am a little confused with the use of ":" like,
>
> hash =3D { :water =3D> 'wet', :fire =3D> 'hot' }
> puts hash[:fire] # Prints: =A0hot
>
> in constructing the hash in this example, ":water" is the key for "wet".
> I understand that. =A0But what is the difference between "water" and
> ":water"?
>
> I am guessing that ":water" works as a variable...but not quite sure.
>
> Sorry if this is a too elementary question.
>
> soichi
>
> --
> Posted via http://www.ruby-forum.com/.
>
>