Skip to content
Guest
Rust · Course Syllabus Show lessons
Core Rust · 9 min read · Intermediate

Rust Basics, Cargo & Immutability by Default

Start with Cargo projects, immutable-by-default bindings, explicit mut, and strong static types.

What you'll learn

  • Create and run projects with cargo new and cargo run
  • Understand why variables are immutable by default unless marked mut
  • Use shadowing and explicit integer/float types cleanly

Overview

Start with Cargo projects, immutable-by-default bindings, explicit mut, and strong static types.

Code Example

fn main() {
    let track = "Rust";
    let mut lessons = 11;
    lessons += 1;
    println!("Learning {track}: {lessons} lessons");
}

Key Takeaways

  • Create and run projects with cargo new and cargo run
  • Understand why variables are immutable by default unless marked mut
  • Use shadowing and explicit integer/float types cleanly

Quick Check

Check Your Understanding

Score: 0 / 1

1. What happens if you try to reassign `let x = 5; x = 6;` in Rust without `mut`?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind