Learn Rust Programming
Welcome to learnrust.net. These free tutorials teach the Rust programming language from first principles, one short lesson at a time. No prior programming experience is assumed. Work through the chapters in order, or jump to a topic below.
More about these tutorials
These free tutorials teach you how to program in the Rust programming language from first principles. Unlike many other resources, these lessons are written for complete beginners and assume no prior programming experience at all: every concept is introduced step by step, explained in plain language, and demonstrated with complete example programs, each one verified to compile and run exactly as shown. Quizzes throughout let you check that an idea stuck before the next lesson builds on it. Whether you are writing your first line of code or coming to Rust from another language, you can learn Rust here at your own pace, entirely in your browser, with nothing to sign up for and nothing to pay.
Rust is a modern systems programming language used to build everything from command-line tools and web servers to operating systems and game engines. It is known for catching entire categories of bugs at compile time, which makes it an unusually good teacher: the compiler explains what went wrong and often suggests how to fix it. These tutorials lean into that strength, showing you not just what correct code looks like, but how to read the error messages you will inevitably encounter and what they are telling you about your program.
The chapters below are designed to be read in order, as each lesson builds on the ones before it. The pacing is deliberate: you will be writing complete, useful programs for several chapters before ownership and borrowing arrive, so Rust's famously hard ideas land on solid footing rather than on page one. The format is modeled on learncpp.com, the long-running C++ tutorial site, so if you have studied there the structure will feel familiar. Each lesson ends with links to the previous and next lessons, so you can move through the course without returning to this page. New lessons are added regularly, and existing ones are revised as the language evolves.
- 0.1 Introduction to these tutorials
- 0.2 Introduction to programs and languages
- 0.3 Introduction to Rust
- 0.4 Introduction to Rust development
- 0.5 The compiler, Cargo, and crates
- 0.6 Installing Rust
- 0.7 Setting up a code editor
- 0.8 Compiling your first program
- 0.9 A few common problems
- 0.10 Build configurations: debug and release
- 0.11 Warnings, lints, and Clippy
- 0.12 Rust editions
- 1.1 Statements and the structure of a program
- 1.2 Comments
- 1.3 Introduction to values and variables
- 1.4 Variables, mutability, and initialization
- 1.5 Introduction to println! and formatting
- 1.6 Reading input: a first look
- 1.7 Compiler errors and how to read them
- 1.8 Keywords and naming identifiers
- 1.9 Whitespace and basic formatting
- 1.10 Introduction to literals and operators
- 1.11 Expressions and statements
- 1.12 Developing your first program
- 1.x Chapter 1 summary and quiz
- 4.1 Introduction to fundamental data types
- 4.2 Integer types
- 4.3 isize, usize, and integer literals
- 4.4 Integer overflow
- 4.5 Floating-point types
- 4.6 Boolean values
- 4.7 Introduction to if expressions
- 4.8 char and a first look at Unicode
- 4.9 Type inference and annotations
- 4.10 Numeric conversions with as
- 4.11 Tuples and the unit type
- 4.x Chapter 4 summary and quiz
- 7.1 Control flow introduction
- 7.2 Working with if and else
- 7.3 Introduction to match
- 7.4 loop and while
- 7.5 for loops and ranges
- 7.6 break, continue, and loop labels
- 7.7 Introduction to recursion
- 7.8 Halting your program early
- 7.9 Adding a dependency: random numbers
- 7.10 Project: the number guessing game
- 7.x Chapter 7 summary and quiz