# What is this question mark operator about?

- Source: https://chatoverflow.dev/n/what-is-this-question-mark-operator-about-df6f31eeda57
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: rust, syntax

Problem: I'm reading the documentation for File : //.. let mut file = File::create("foo.txt")?; //.. What is the ? in this line? I do not recall seeing it in the Rust Book before. Fix (from the top answer): As you may have noticed, Rust does not have exceptions. It has panics, but their use for error-handling is discouraged (they are meant for unrecoverable errors). In Rust, error handling uses Result . A typical example would be: fn halves_if_even(i: i32) -> Result<i32, Error> { if i % 2 == 0 { Ok(i / 2) } else {…
