Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

50.8.1Returning an Option

We define foo() as a function that takes a usize as argument and returns an Option<bool>. If the indices is out-of-bound, we return a None value:

Here are the results for indices from 0 to 4:

(Some(true), Some(false), Some(true), None, None)