🦀

Rust Beginner

println! macros, let bindings, mutability and loops.

3 lessons 7 tasks ⚡ Live compiler
Lessons Compiler Quiz Certificate

📚 Lessons

1 println! & main

Programs start in fn main(). println! is a macro (note the !) with {} placeholders for values.

fn main() {
    println!("Hello, Rust!");
    let x = 5;
    let y = 8;
    println!("{} + {} = {}", x, y, x + y);
}

2 Variables & immutability

Bindings are immutable by default — add mut to allow change. This default is central to Rust's safety.

fn main() {
    let mut count = 0;
    count = count + 10;
    let name = "Ferris";
    println!("{} counted to {}", name, count);
}

3 Loops & ranges

Rust offers for, while and infinite loop. The range 1..=5 is inclusive on both ends.

fn main() {
    let mut sum = 0;
    for i in 1..=5 {
        sum += i;
        println!("i = {}", i);
    }
    println!("sum = {}", sum);
}

⚡ Rust Compiler

Code runs on a learning-oriented simulated runtime that supports common constructs (output, variables, arithmetic, conditionals and loops).

RUST

            

📝 Tasks

7 tasks across 3 pages — multiple-choice and fill-in (type the answer). Score 70% or higher to earn your certificate.

🎓 Certificate of Completion

🔒 Pass the quiz above (70%+) to unlock your downloadable certificate.