uses strings and interpolation with Dynamic Code Execution : eval « Reflection « Ruby
- Ruby
- Reflection
- eval
uses strings and interpolation with Dynamic Code Execution
my_number = 15
my_code = %Q{#{my_number} * 2}
puts eval(my_code)
Related examples in the same category