- 01Setting up (what you'll need)
- 02Your first output (println!)
- 03Variables and mutability (let / mut)
- 04Type annotations and basic types
- 05Branching (the if statement)
- 06Repeating (the for loop)
- 07Writing your own function
- 08Repeating (while and loop)
- 09Ownership, the basics
- 10Borrowing (references, &)
- 11Working with vectors (Vec)
- 12Structs
- 13enum and the match expression
- 14The Option type (null safety)
- 15The Result type and error handling
- 16Traits
- 17Generics
- 18Closures
- 19Working with strings (String)
- 20[Project] Build a small inventory system
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.
๐งช 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).
