From: "DanDiebolt.exe" Date: 2008-12-16T19:10:16+09:00 Subject: Re: Unique values in hash? --0-1237728586-1229422672=:73471 Content-Type: text/plain; charset=us-ascii h=Hash[*%w(a alex b mary c alex).flatten] => {"a"=>"alex", "b"=>"mary", "c"=>"alex"} irb(main):014:0> h.values => ["alex", "mary", "alex"] irb(main):015:0> h.values.uniq => ["alex", "mary"] --- On Tue, 12/16/08, Vapor .. wrote: From: Vapor .. Subject: Unique values in hash? To: "ruby-talk ML" Date: Tuesday, December 16, 2008, 3:48 AM Hi, I have a hash that contains duplicate data, for example, :username => "alex" comes many times. I want to loop around and print their names just once (only unique). In simple loop it would print "alex" repeatedly. Thanks. -- Posted via http://www.ruby-forum.com/. --0-1237728586-1229422672=:73471--