I will describe how to display the contents of the prepared variable when using the puts method of Ruby.
Ruby 2.6.5
To display the contents of the variable, write as follows.
number = 10
puts number
puts "#{number}"
puts '#{number}'
Execution result
10
10
#{number}
` * The point is that if you enclose it in single quotes, it will be output as it is. ``
Recommended Posts