Search⌘ K

Printing Styles

Explore the various printing macros in Rust including print, println, eprint, and eprintln. Understand their differences and how to use them to display standard output or error messages with or without newlines in Rust programs.

The table below summarizes the macros used to print in Rust.

Let’s discuss each of the macros in detail.

print!()

The print!() macro simply prints the output to the console.

Example

The following example prints “Rust Programming Course” ...