Stdle #123 · option · 2026-10-07
What does this Rust snippet output?
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
fn main() { let s = Some("12"); let n = s.and_then(|t| t.parse::<i32>().ok()); println!("{:?}", n); let bad = Some("ab") .and_then(|t| t.parse::<i32>().ok()); println!("{:?}", bad);}Option