Rust Basics
Bind values and print them.
Rust
fn main() {
let name = "Ada";
println!("Hello, {}", name);
}Output
Hello, Ada
Explanation
let creates a binding. println! is a macro that formats and writes a line. Bindings are immutable unless declared mut.
Explore the dry run
Guided walkthroughReady
1
fn main() {2
let name = "Ada";3
println!("Hello, {}", name);4
}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 slice to name. | name = "Ada" | — | |
| The macro substitutes name into the placeholder. | name = "Ada" | Hello, Ada |