Flowdock
method

key

Importance_1
Ruby latest stable (v1_9_3_392) - 0 notes - Class: Hash
key(p1) public

Returns the key of an occurrence of a given value. If the value is not found, returns nil.

h = { "a" => 100, "b" => 200, "c" => 300, "d" => 300 }
h.key(200)   #=> "b"
h.key(300)   #=> "c"
h.key(999)   #=> nil
Show source
Register or log in to add new notes.