------ art_20142_979142.1171773476441 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for your response. I think now the differences and similarities between Set, Hash and Array are clear to me. But with respect to memory consumption which one of among the following is better: s et.new([1,2,3]) h 1 il, 2 il, 3 nil} On 2/17/07, Peter Szinek <peter / rubyrailways.com> wrote: > > SunRaySon wrote: > > Are there any general guidelines on when a "Set" should be used and when > a > > "Hash" should be used. Are there any limitations to "Set" > > A Set is similar to an Array - the two major differences are that a Set > is unordered (because it's implementation is based on a Hash) and that a > Set contains every element only once (i.e. if you add an element which > is already there, the Set won't change). > > You should use a Hash if you have a dictionary-like structure (i.e. key >