From: dare ruby Date: 2008-02-05T18:17:00+09:00 Subject: Re: How to add string objects to hash? Thank you very much for your information. what you said is right. I want to put my strings into hash. But two objects are required for hash. Is it possibble to use hashcode method to be used as key and string as a value. If its possible please suggest a way to do so because i need to put my strings into a hash. Thanks in advance.. > > This is an example of a hash: > > h = {"a"=>"circle", "b"=>"square", "c"=>"triangle"} > puts h["a"] > > --output:-- > circle > > Note that every element of a hash is a key/value pair. You say, "I want > to put my strings into a hash", but the elements of a hash are not > single objects--the elements of a hash are pairs of objects. If your > strings are to be the values, what do you want to be the keys? -- Posted via http://www.ruby-forum.com/.