Ad space (banner)
Lesson 2 / 20

Your first output (println!)

This lesson covers the basics of printing in Rust with println!.

println!("...") displays text on the screen. The ! at the end marks this as a macro rather than an ordinary function. Rust runs about as fast as C++ while building protection against memory-related bugs into the language itself.

In the sample code, a single line — println!("Hello, Rust!"); — sits inside the fixed fn main() { ... } frame. Do not forget the semicolon at the end of the line.

A common early stumble is leaving off the ! after println. That symbol is what calls a macro, and it is deliberately distinct from a normal function call.

In professional work, Rust is spreading into browser engines, command-line tools, and code close to the operating system — anywhere both safety and speed are required.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run Rust directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)