Intro Exercises

Overview

The intro exercises familiarize you with the Rustlings workflow and basic Rust syntax.


intro1 - Getting Started

Concept: Navigating Rustlings

The first exercise is simply about learning how to use Rustlings itself. Press n in the terminal to move to the next exercise.

fn main() {
    // Congratulations, you finished the first exercise 🎉
    // As an introduction to Rustlings, the first exercise only required
    // entering `n` in the terminal to go to the next exercise.
}

Key Takeaway: Rustlings watches your files — saving triggers a recheck.


intro2 - Hello World

Concept: The println! macro

The fix was simple: use println! instead of printline!.

fn main() {
    println!("Hello world!");
}

Key Takeaways:

  • println! is a macro (notice the !)
  • Macros are different from functions — they expand at compile time
  • The exclamation mark distinguishes macros from regular functions

Rust Book Reference