Ruby - Hashes
Identify the error in this Ruby code that tries to set a default value of 0 for missing keys:
h = Hash.new h.default = 0 puts h[:missing]
h = Hash.new h.default = 0 puts h[:missing]
h.default = 0 correctly sets the default value for missing keys after hash creation.h[:missing] returns 0 as expected, no error occurs.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions