← Back to archive

Stdle #89 · option · 2026-09-03

What does this Rust snippet output?

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

fn main() {
let ok: Result<i32, String> = Ok(9);
let err: Result<i32, String> =
Err("bad".into());
println!("{:?}", ok.ok());
println!("{:?}", err.ok());
}
Option
2 lines
4 attempts left

Answer & explanation