quest

Sign in to start training

quest keeps your progress, streaks, and scores tied to your account — so you can pick up on any device.

Synced everywhere. Progress follows you across laptop and phone.
Streaks & stats. See your daily run and every score over time.
Your profile. A name and avatar for the work you do here.

We only use Google to sign you in and sync progress. No posting, no contacts — ever.

Applied Intermediate

13  Combinators

Most match statements on Option have a one-word replacement. Transform the inside of an Option with map, then fold a whole parse-with-default flow into a single chain.

Step 1 / 2

In first_upper, uppercase the first character if there is one -- map, no match.

Hints
  • s.chars().next() is the Option<char> you start from.
  • .map(|c| c.to_ascii_uppercase()) transforms the inside without unwrapping.
13_combinators.rs
Reset to starterCompiled in a sandbox; hidden checks must pass.
Reveal solution
fn first_upper(s: &str) -> Option<char> {
    s.chars().next().map(|c| c.to_ascii_uppercase())
}