Ruby - Hashes
Identify the error in this Ruby code snippet:
a = {x: 10}b = {y: 20}a.merge! b
puts a
Identify the error in this Ruby code snippet:
a = {x: 10}b = {y: 20}a.merge! b
puts a
merge! method callmerge! can be called without parentheses in Ruby, so a.merge! b is valid syntax.merge! updates a with keys and values from b, so a becomes {x: 10, y: 20}. No errors occur.merge! updates original hash without error [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions