How to print variable in string with Ruby

2 Answers

0 votes
x = 345

puts "x = #{x}"



# run:
#
# x = 345
#

 



answered Dec 19, 2020 by avibootz
0 votes
x = 456
y = 981

puts "#{x} + #{y} = #{x+y}"



# run:
#
# 456 + 981 = 1437
#

 



answered Dec 19, 2020 by avibootz
...