creates a new default object each time : Hash Creation « Hash « Ruby
- Ruby
- Hash
- Hash Creation
creates a new default object each time
h = Hash.new {|hash, key| hash[key] = "Go Fish: #{key}" }
h["c"]
h["c"].upcase!
h["d"]
h.keys
Related examples in the same category