Single quoted
Only replaces \' and \\puts 'This is a single line text'
puts 'This is a
multiline text'
Double quoted
Full replacement:x = 10
y = 20
puts "x is #{x}, y is #{y}, the sum is #{x + y}."
Here Document
Multi-line replacement:print <<EOF
+First line.
+Second line.
EOF
print <<"EOF";
-First line.
-Second line.
EOF
Command execution:
print <<`EOC`
echo Hello!
ls -l
EOC
You can stack them:
print <<"+++", <<"---"
*First line.
*Second line.
+++
*Another line.
*Yet another line.
---
Note: All strings can be multi-line!