1

So I have a string formatted with triple quotation marks or %q{} like this and I want to insert a variable into the string; apparently using #{variable} wouldn't work.

variable = "some string" 
puts %q{
My string looks like
this and i want to show
my string here #{variable}
}

1 Answers1

0

Just use uppercase "Q"

variable = "some string"
%Q{ My math #{1+1} and string #{variable}}
7urkm3n
  • 6,054
  • 4
  • 29
  • 46