...

/

Let Me Ask You a Question

Let Me Ask You a Question

We'll cover the following...

That code in the previous lesson looks a little repetitive, doesn’t it? Match on an Option, check if the option is None, if it’s None, then return None. If it’s Some, then evaluate to that value. Wouldn’t it be great if there was a nice, easy way to capture that idea in a much shorter amount of code?

Fortunately, there is! This idea of "None propagation" is so common in Rust that it’s captured in a single character: ?. Observe:

Access this course and 1400+ top-rated courses and projects.