Ruby - Hashes
Which of the following is the correct syntax to update hash a with hash b in Ruby?
a = {x: 1}b = {y: 2}Which of the following is the correct syntax to update hash a with hash b in Ruby?
a = {x: 1}b = {y: 2}update is a method that modifies the original hash and takes another hash as argument with parentheses.merge! also updates but usually called with ! and parentheses are optional but update(b) is the most explicit and correct syntax here.update() to modify original hash [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions