Typically when an element is passed into a hash with no matching key, the hash returns nil
.
hsh = {1 => "one", 2 => "two"}
hsh[3] #=> nil
I want to form a hash that returns the value passed into it if there is no match.
hsh[3] #=> 3
I'm guessing that a solution for this might involve a lambda of some kind...?
** Right now I'm using a clumsy solution for this that uses a conditional method to prevent non-matching keys from being passed into the hash..