← Back to archive

Stdle #121 · option · 2026-10-05

What does this Rust snippet output?

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

fn main() {
let s: Option<String> = None;
println!("[{}]", s.unwrap_or_default());
let n: Option<i32> = None;
println!("{}", n.unwrap_or_default());
let b: Option<bool> = None;
println!("{}", b.unwrap_or_default());
}
Option
3 lines
4 attempts left

Answer & explanation