4 lines
134 B
Ruby
4 lines
134 B
Ruby
p "Enter a variable name"
|
|
x = gets.chomp!
|
|
instance_variable_set "@" + x, 42
|
|
p "The value of #{x} is #{instance_variable_get "@" + x}"
|