Skip to content

Glossary: Rust Basics

? operator

Also written: question mark operator, ?

Placed after something that returns a `Result`, it takes out the value if it is `Ok`, or returns the error to the caller straight away if it is `Err`. It only works in a function that itself returns a `Result` or `Option`.

Where the book teaches it

Related terms

ResultOption