Syntax
Ruby String Interpolation Syntax
In Ruby, string interpolation: inserts values into a string — "Hi #{name}"
Quick Answer
- Syntax
"Hi #{name}"
RubySyntax
String Interpolation
Inserts values into a string.
How to string interpolation in Ruby
- Open your Ruby file or editor.
- Copy the example, then replace its sample names and values for your code.
Ruby String Interpolation Syntax
Use "Hi #{name}".
Related Syntax References
Frequently asked questions
What is the Ruby syntax for string interpolation?
Use this pattern: "Hi #{name}"
Can I copy this Ruby code example?
Yes. Use Copy code and adapt the example to your program.
Is this Ruby syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify