← Back to archive

Stdle #86 · scope · 2026-08-31

What does this Rust snippet output?

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

fn main() {
let x = 2;
let y = match x {
n if n < 0 => { let n = -n; n }
n => { let n = n * n; n }
};
println!("{}", y);
}
Scope
4 attempts left

Answer & explanation