← Back to Gists

string interpolation

📝 Ruby
moniquediaz119
moniquediaz119 · Level 10 ·

String interpolation in Ruby lets you embed expressions directly into a string using #{}, making code cleaner and more readable.

Ruby
name = "Alice"
age = 25
puts "#{name} is #{age} years old."
puts "Next year she will be #{age + 1}."
puts "Her name reversed is #{name.reverse}."

Comments

No comments yet. Start the discussion.