Ruby - Hashes
Identify the error in this Ruby code snippet:
a = {foo: 1}b = {bar: 2}a.merge! b
puts b
Identify the error in this Ruby code snippet:
a = {foo: 1}b = {bar: 2}a.merge! b
puts b
merge! modifies a, not b.b remains unchanged, so output is {:bar=>2}.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions