Ruby - Hashes
Which syntax correctly sets the value of key
:name to "Alice" in a Ruby hash person?:name to "Alice" in a Ruby hash person?=.person[:name] = "Alice" correctly sets the key :name. person.name = "Alice" is invalid for hashes. person["name"] = Alice misses quotes around Alice, causing error. person[:name] == "Alice" is a comparison, not assignment.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions