Swift Basics
Bind a constant and print it.
Swift
let name = "Ada"
print("Hello, \(name)")Output
Hello, Ada
Explanation
let creates a constant. String interpolation evaluates the expression in parentheses and inserts it into the output.
Explore the dry run
Guided walkthroughReady
1
let name = "Ada"2
print("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 |
|---|---|---|---|
| Bind an immutable string to name. | name = "Ada" | — | |
| Interpolate name and print the greeting. | name = "Ada" | Hello, Ada |