← Back to archive

Stdle #59 · comparisons · 2026-08-04

What does this Rust snippet output?

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

fn main() {
let n: i32 = 42;
let msg = match n {
x @ 40..=50 => format!("in range: {}", x),
_ => "out".to_string(),
};
println!("{}", msg);
}
Comparisons
4 attempts left

Answer & explanation