Learn Rust from your first println! to ownership, borrowing and a small gradebook project, with every exercise checked as you go.
15 lessons, 30 exercises. Runs Rust 1.93.
Not started
Hello, output
Write your first Rust program, print text with println!, format values, and add comments.
Values and variables
Bind values with let, opt in to change with mut, use shadowing and constants, and meet Rust's basic types.
Reading input and arithmetic
Read text from standard input, parse it into numbers, and do integer and floating-point arithmetic.
Making decisions
Branch with if and else, use if as an expression, compare values, and match on patterns.
Loops
Repeat work with for over ranges, while and loop, and control it with break, continue and labels.
Functions
Define functions with typed parameters and return values, use expression bodies, return tuples, and understand scope.
Collections
Store many values in arrays, vectors and hash maps, index them safely, and loop over them.
Strings and a small project
Tell String from &str, work with UTF-8 text through chars and string methods, then build a small word-stats program.
Handling errors
Use Option and Result to represent missing values and failures, handle them with match, and pass them up with the ? operator.
Structuring data
Model data with structs and enums, add behaviour with impl blocks, and derive common traits.
Recursion
Solve problems with functions that call themselves, using a base case, slice patterns and memoisation.
Sorting and searching
Sort vectors with sort, sort_by and sort_by_key, break ties with Ordering, and search sorted data with binary_search.
Maps and sets in depth
Count and group with the entry API, keep keys ordered with BTreeMap, and combine HashSets with union, intersection and difference.
Ownership and borrowing
Understand Rust's signature feature, how values are owned, moved, cloned and borrowed, so memory is safe without a garbage collector.
Final project: gradebook
Build a command-driven gradebook that combines structs, ordered maps, Result-based errors, borrowing and input parsing.
Your progress is saved in this browser. Sign in to keep it on every device.