← Back to archive

Stdle #63 · comparisons · 2026-08-08

What does this Rust snippet output?

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

fn main() {
let n = 5;
let s = match n {
x @ 1..=3 => format!("low {}", x),
x @ 4..=6 => format!("mid {}", x),
x => format!("hi {}", x),
};
println!("{}", s);
}
Comparisons
4 attempts left

Answer & explanation