Ruby - Doing math in double-quoted string

Introduction

A double-quoted string can evaluate expressions such as 2*3.

Demo

puts( "My name is #{2*3}" ) 
puts( "My name is #{2+3}" ) 
puts( "My name is #{(1+2)-2*3}" )

Result

Related Topic