Heredocs and format
Heredocs write long text. format and % build strings from patterns.
Example
name = "Ada"
text = <<~TXT
Hello #{name}
indented
TXT
puts text
puts format("%-6s|%6.2f|%03d", "ab", 3.14159, 7)Result
Hello Ada indented ab | 3.14|007
Exercise
Squiggly heredoc.
<<TXT
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.