hsh.delete(key) â value
hsh.delete(key) {| key | block } â value
hsh.delete(key) {| key | block } â value
Instance Public methods
Deletes the key-value pair and returns the value from hsh whose key is equal to key. If the key is not found, returns the default value. If the optional code block is given and the key is not found, pass in the key and return the result of block.
h = { "a" => 100, "b" => 200 } h.delete("a") #=> 100 h.delete("z") #=> nil h.delete("z") { |el| "#{el} not found" } #=> "z not found"
Please login to continue.