← Back to archive

Stdle #176 · comparisons · 2026-11-29

What does this Rust snippet output?

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

fn main() {
let x = Some(0);
let s = match x {
Some(n) if n > 0 => "positive",
Some(_) => "non-positive",
None => "nothing",
};
println!("{}", s);
}
Comparisons
4 attempts left

Answer & explanation