← Back to archive

Stdle #88 · ownership · 2026-09-02

What does this Rust snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

fn add_one(mut n: i32) -> i32 {
n += 1;
n
}
fn main() {
let x = 5;
let y = add_one(x);
println!("{} {}", x, y);
}
Ownership
4 attempts left

Answer & explanation