Ruby Basics
Store text and print it.
Ruby
name = "Ada"
puts "Hello, #{name}"Output
Hello, Ada
Explanation
Assignment binds a value to a name. String interpolation inserts an expression inside double-quoted text. puts writes a line.
Explore the dry run
Guided walkthroughReady
1
name = "Ada"2
puts "Hello, #{name}"Follow the example
Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.
View the complete dry-run table
| Step / line | What happens | State after step | Output so far |
|---|---|---|---|
| Assign the string to name. | name = "Ada" | — | |
| Interpolate name and write a line. | name = "Ada" | Hello, Ada |