# Rust Tutorial > A free, practical, beginner-friendly guide to Rust. Short lessons, real code > you can run in the browser, and honest notes on the parts that trip people > up — ownership, borrowing, and everything after. ## Is Rust hard to learn? Rust has a reputation for being difficult, but that's mostly about the first week or two. Ownership and borrowing are genuinely new ideas if you're coming from a garbage-collected language, and the compiler will reject code you expect to work. That friction is short-lived — most people get past it faster than they expect, because the compiler's error messages are unusually good and tell you exactly what to fix. Once ownership clicks, the rest of the language reads like a stricter, safer version of languages you already know. This tutorial is built to shorten that curve: small steps, real runnable examples on every page, and a "Try it Yourself" button so you can break code and see what happens instead of just reading about it. ## What this site is for - **Every lesson is a single focused page** — one topic, a plain-English explanation, and working code, in an order that builds on itself. - **Every code sample runs** — click "Try it Yourself" and the example opens directly in the official Rust Playground, so there's nothing to install to follow along. - **Free, no account, no paywall.** Nothing is gated behind a signup. - **Written for beginners, but the later chapters go deep** — generics, traits, smart pointers, concurrency, and unsafe Rust are all covered, not just the basics. ## Getting Started - [Rust Tutorial](https://rusttutorial.org/): A practical, beginner-friendly guide to Rust. Short lessons, real code you can run in the browser, and honest notes on the parts that trip people up. - [Rust Intro](https://rusttutorial.org/intro/): What Rust is, the problem it solves, and where it fits next to languages you already know. - [Rust Get Started](https://rusttutorial.org/get-started/): Install Rust with rustup, understand cargo, and create and run your first project step by step. - [Rust Syntax](https://rusttutorial.org/syntax/): The anatomy of a Rust program — the main function, statements, expressions, semicolons, and macros explained for beginners. - [Rust Comments](https://rusttutorial.org/comments/): How to write comments in Rust — line comments, block comments, and documentation comments — with examples. - [Rust Output](https://rusttutorial.org/output/): The different ways to print output in Rust — println!, print!, format!, and debug printing with {:?}. ## Basics - [Rust Variables](https://rusttutorial.org/variables/): How variables work in Rust — creating them, why they're immutable by default, mutability, shadowing, and constants. - [Rust Data Types](https://rusttutorial.org/data-types/): The core data types in Rust — integers, floats, booleans, characters, and strings — explained with examples. - [Rust Operators](https://rusttutorial.org/operators/): Arithmetic, comparison, logical, and assignment operators in Rust, with examples of each. - [Rust Booleans](https://rusttutorial.org/booleans/): The bool type in Rust — true and false, and how they drive conditions and logic. - [Rust Strings](https://rusttutorial.org/strings/): The difference between &str and String, common string methods, and how to build and combine text in Rust. - [Rust Type Casting](https://rusttutorial.org/type-casting/): How to convert between types in Rust using the as keyword, and parsing strings into numbers. ## Control Flow - [Rust If...Else](https://rusttutorial.org/if-else/): Conditional branching in Rust with if, else if, and else — including using if as an expression. - [Rust Match](https://rusttutorial.org/match/): Rust's match expression — a more powerful alternative to long if/else chains, including the catch-all pattern and matching multiple values. - [Rust If Let / While Let](https://rusttutorial.org/if-let/): if let and while let in Rust — a shorter way to handle a single match arm without writing a full match block. - [Rust Loops](https://rusttutorial.org/loops/): The loop keyword in Rust — an intentionally infinite loop that runs until you break out of it, and how to return a value from it. - [Rust While](https://rusttutorial.org/while/): while loops in Rust — repeating code as long as a condition holds true. - [Rust For](https://rusttutorial.org/for/): for loops in Rust — iterating over ranges and collections, the loop you'll use most often. - [Rust Break/Continue](https://rusttutorial.org/break-continue/): Controlling loops in Rust with break and continue, and labeling loops to control an outer loop from within a nested one. ## Functions - [Rust Functions](https://rusttutorial.org/rust-functions/): How to define, call, and return values from functions in Rust — with parameters, return types, and the expression rule explained. - [Rust Scope](https://rusttutorial.org/scope/): What scope means in Rust, how curly braces define it, and how it connects to when values get dropped. - [Rust Closures](https://rusttutorial.org/closures/): An introduction to closures in Rust — anonymous functions that can capture variables from their surrounding scope. ## Collections - [Rust Tuples](https://rusttutorial.org/tuples/): Tuples in Rust — grouping different types of values together, accessing them by position, and destructuring. - [Rust Arrays](https://rusttutorial.org/arrays/): Fixed-size arrays in Rust — declaring them, accessing elements, and how Rust protects you from out-of-bounds access. - [Rust Vectors](https://rusttutorial.org/vectors/): Vec, Rust's growable list type — creating, adding, removing, and looping over vectors. - [Rust Slices](https://rusttutorial.org/slices/): Slices in Rust — borrowing a section of an array or vector without copying it. - [Rust HashMaps](https://rusttutorial.org/hashmaps/): HashMap in Rust — storing key-value pairs, inserting, looking up, and looping over entries. - [Rust Structs](https://rusttutorial.org/structs/): Structs in Rust — grouping related data into a named, reusable type, with fields, methods, and the derive attribute. - [Rust Enums](https://rusttutorial.org/enums/): Enums in Rust — defining a type with a fixed set of possible values, attaching data to variants, and matching on them. ## Building Real Programs - [Rust Modules](https://rusttutorial.org/modules/): Organizing Rust code with modules — the mod keyword, pub visibility, use, and splitting code across multiple files. - [Rust Command-Line Arguments](https://rusttutorial.org/cli-arguments/): Reading command-line arguments in Rust with std::env::args, and a first look at the clap crate for real CLI tools. - [Rust File I/O](https://rusttutorial.org/file-io/): Reading and writing files in Rust using std::fs, and handling the errors that come with it using Result. ## Memory - [Rust Ownership](https://rusttutorial.org/ownership/): Ownership is the concept that makes Rust unique. Learn the three rules, what "move" means, and why it keeps your programs safe — explained simply. - [Rust Borrowing](https://rusttutorial.org/borrowing/): Borrowing lets functions use a value without taking ownership. Learn references, mutable references, and the borrowing rules that keep Rust safe. - [Rust Lifetimes](https://rusttutorial.org/lifetimes/): A gentle introduction to lifetimes in Rust — why the compiler sometimes needs help proving a reference stays valid long enough. ## Error Handling - [Rust Option](https://rusttutorial.org/option/): The Option type in Rust — how it replaces null, and the safe ways to work with a value that might be missing. - [Rust Result](https://rusttutorial.org/result/): The Result type in Rust — handling operations that can fail, with Ok and Err, and the ? operator for propagating errors. - [Rust Panic](https://rusttutorial.org/panic/): How panic! works in Rust, when your program panics on its own, and how to decide between panicking and returning a Result. - [Rust Custom Errors](https://rusttutorial.org/custom-errors/): Defining your own error types in Rust with enums, implementing the Display trait, and why String errors don't scale. ## Traits & Generics - [Rust Generics](https://rusttutorial.org/generics/): Generics in Rust — writing functions and structs that work with any type, instead of duplicating code for each one. - [Rust Traits](https://rusttutorial.org/traits/): Traits in Rust — defining shared behavior that different types can implement, and using traits as function parameters. - [Rust Iterators](https://rusttutorial.org/iterators/): Iterators in Rust — looping with .iter(), and the map, filter, and collect methods for transforming collections. ## Advanced Topics - [Rust Smart Pointers](https://rusttutorial.org/smart-pointers/): An introduction to Box, Rc, and RefCell — Rust's smart pointers for the cases plain ownership rules don't cover on their own. - [Rust Concurrency](https://rusttutorial.org/concurrency/): An introduction to threads in Rust, and how ownership prevents the data races that make concurrent code dangerous in other languages. - [Rust Unsafe](https://rusttutorial.org/unsafe-rust/): What the unsafe keyword actually does in Rust, what it unlocks, and why it's not the escape hatch it sounds like. - [Rust Macros](https://rusttutorial.org/macros/): What macros actually are in Rust, why println! needs a !, and writing a simple macro of your own with macro_rules!. ## Wrap-Up - [Rust Testing](https://rusttutorial.org/testing/): Writing your first tests in Rust with the #[test] attribute, assert! macros, and running them with cargo test. - [Rust Next Steps](https://rusttutorial.org/next-steps/): Where to go after finishing this tutorial — project ideas, crates worth knowing, and the official resources to keep learning from. ## Reference - [Rust Cheat Sheet](https://rusttutorial.org/cheat-sheet/): A quick-reference page for Rust keywords, common String, Vec, HashMap, Option, and Result methods, and formatting specifiers.