println!
Writes values and moves to a new line.
Syntax
println!("{}", value)Description
It is a macro (with !). A value goes into the {} placeholder. {:?} is the 'debug' format (for arr/struct).
Example
Loading editor…
Expected output
Hello World 2 + 3 = 5
When to use?
Showing results, debugging.
Common mistakes
- ⚠️ The ! at the end of println! (macro indicator) is mandatory.