+ 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
1 Answer
+ 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