Skip to main content


Day 3: Prints in Rust

Welcome back, fellow Rustaceans 🦀.

In our last article, we created our first Rust program, learned how to compile and build it with rustc. We also explored how to manage projects effectively using Rust's build system, Cargo. Today, we'll dive into the various ways Rust's standard library helps us with printing and logging. Understanding how to output information is a fundamental step when learning any new language – let's jump right in!

You can find all the code examples we will discuss in the Rust repository on the inpyjama GitHub page: To run the demo, navigate to the "day3" folder and execute cargo run.

GitHub - inpyjama/rust
Contribute to inpyjama/rust development by creating an account on GitHub.

The Print Macros

Let's start with the foundational building blocks of printing in Rust: println! and print!. The println! macro inserts a newline character after printing your message, ensuring subsequent output appears on a new line. Conversely, the print! macro displays your message without any additional newline characters.