← Back to archive

Stdle #101 · option · 2026-09-15

What does this Rust snippet output?

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

fn main() {
let x = Some(6);
let r = x.filter(|n| n % 2 == 0);
println!("{:?}", r);
let y = Some(7);
println!("{:?}", y.filter(|n| n % 2 == 0));
}
Option
2 lines
4 attempts left

Answer & explanation