Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyRustOption and ? on OptionSingle-choice MCQ

In a function returning `Result`, why does `let first = v.first()?;` fail to compile when `v.first()` returns an `Option`?

fn get(v: &[i32]) -> Result<i32, String> { let first = v.first()?; Ok(*first) }