I wonder if it is possible to concatenate a variable value or a string to a new variable value declaration in Ruby.
foo = "something"
#new variable declaration:
var_ + foo = "concat variable name"
p var_foo # => "concat variable name"
n = 2
position + n = Array.new(3, 1)
p position2 # => [1, 1, 1]`
Thank you very much
Binding#local_variable_set//local_variable_set, but this is not exactly what you are looking for. Why do you need it?eval, but but both approaches make the code hard to maintain. My feeling is that you have here a XY-problem. Even in PHP, I don't see why you would want to do this for a local variable.