+ 2

Ruby Hash

I have code info = {name:""} puts = "Enter name" name = gets How I can change value of :name to variable 'name'?

18th Sep 2018, 9:00 PM
Влад Фотьянов
Влад Фотьянов - avatar
2 Answers
+ 5
You can use this sentence: info [:name] = name Example: info = {name:""} puts = "Enter name" name = gets #asign value name to the hash info [:name] = name puts info[:name] info [:name] = "Myself" puts info[:name]
18th Sep 2018, 11:15 PM
Nimrod A. HolguĂ­n L.
Nimrod A. HolguĂ­n L. - avatar