Enter your book access code

The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).

Don’t have the book yet? The landing page stays open — purchase unlocks this gym.

beginner · order 15

let-else early return

opt-let-else-01Related book chapters: 2 (optional — this page is complete on its own)let-elseOption

Slug: opt-let-else-01 · Paired reading: Chapter 2

Prompt

fn first_even(nums: &[i32]) -> Option<i32> — use let Some(n) = ... else { return None }; style (or equivalent) to pull the first even value without nested match pyramids.