+ 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 odpowiedzi
+ 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