hsh.default(key=nil) â obj
Instance Public methods
Returns the default value, the value that would be returned by hsh if key did not exist in hsh. See
also Hash::new and Hash#default=.
h = Hash.new #=> {}
h.default #=> nil
h.default(2) #=> nil
h = Hash.new("cat") #=> {}
h.default #=> "cat"
h.default(2) #=> "cat"
h = Hash.new {|h,k| h[k] = k.to_i*10} #=> {}
h.default #=> nil
h.default(2) #=> 20
Please login to continue.