Println! macro
The println! macro is an output operation that formats arguments and writes the resulting text followed by a line terminator to standard output.
Learn Rust in a Month of Lunches
The println! macro formats its arguments and writes the resulting text followed by a newline to standard output.
- How it is used
- Uses `println!` to print text and formatted values, followed by a newline.
- How deep it goes
- Works from basic placeholders through Debug, escapes and formatting options, without explaining macro internals.
- Examples
- Shows a greeting with an inserted number, a Display compiler error, and examples of number bases and aligned output.
- What you can do after
- Apply it in Rust to print formatted values and use compiler feedback to choose a supported placeholder.
Read how Learn Rust in a Month of Lunches explains println! macro →
Rust in Action: Systems programming concepts and techniques
println! is Rust's standard macro for printing formatted output followed by a newline.
- How it is used
- Prints fixed or formatted values to the console while introducing Rust’s macro syntax.
- How deep it goes
- Explains macro notation, stdout, placeholders, and type handling, but treats macros as function-like rather than exposing expansion internals.
- Examples
- Demonstrates greetings in three languages, iterated strings, formatted placeholders, and CSV-processing output.
- What you can do after
- Apply it via Rust syntax to print messages and formatted values during small programs and data-processing tasks.
Read how Rust in Action: Systems programming concepts and techniques explains println! macro →
Related concepts
- Displayuses · Display is Rust’s standard formatting trait for producing a user-facing textual representation of a value.
- dbg! macroalternative to · The Rust dbg! macro evaluates an expression, prints debugging information including its source and value, and returns the expression’s value.
- format! macroalternative to · The Rust format! macro constructs and returns a String by interpolating arguments according to a formatting specification.
- Debuguses · Debug is a Rust standard-library trait for formatting values in programmer-oriented diagnostic representations.
- macrokind of · A macro is a named construct that expands or transforms source code, commands, or templates before or during execution.
- formattinguses · Formatting is the arrangement or transformation of content, data, or code according to specified structural, stylistic, or presentation conventions.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

