hsh.key(value) â key
Instance Public methods
Returns the key of an occurrence of a given value. If the value is not
found, returns nil
.
1 2 3 4 | h = { "a" => 100 , "b" => 200 , "c" => 300 , "d" => 300 } h.key( 200 ) #=> "b" h.key( 300 ) #=> "c" h.key( 999 ) #=> nil |
Please login to continue.