From: Stu Date: 2010-12-09T17:29:54+09:00 Subject: Re: Hash? But variables? 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=[1,2,3] you would get 2 by accessing via a[1] (index starts at zero) as a hash it could be written a={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 => 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 wrote: > Hi.  I am a little confused with the use of ":" like, > > hash = { :water => 'wet', :fire => 'hot' } > puts hash[:fire] # Prints:  hot > > in constructing the hash in this example, ":water" is the key for "wet". > I understand that.  But 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/. > >