+ 2
Ruby Hash
I have code info = {name:""} puts = "Enter name" name = gets How I can change value of :name to variable 'name'?
2 ответов
+ 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]