On Apr 12, 11:54 am, "Jean-SñÃastien" <jeansebastien.... / gmail.com>
wrote:
> hello,
>
>   a little question... how to get distinct values from an hash?
>
> ex:
> hash = {"a"=>100, "b"=>200, "d"=>100, "d"=>200}
> ==> hash_with_distinct_values = [100, 200]
>
> thanks.

irb(main):001:0> hash = {"a"=>100, "b"=>200, "d"=>100, "d"=>200}
=> {"a"=>100, "b"=>200, "d"=>200}
irb(main):002:0> hash.values.uniq
=> [100, 200]