Challenge 1: Parsing an Age Safely — Possible Solution ==================================================================== fn parse_age(input: &str) -> Result { match input.trim().parse::() { Ok(age) => Ok(age), Err(_) => Err(format!("'{}' is not a valid age", input)), } } fn main() { match parse_age("30") { Ok(age) => println!("Valid age: {}", age), Err(message) => println!("Error: {}", message), } match parse_age("not a number") { Ok(age) => println!("Valid age: {}", age), Err(message) => println!("Error: {}", message), } } WHY THIS WORKS AS AN ANSWER ------------------------------ parse_age returns Result, exactly matching the required signature — Ok(u8) for a successfully parsed age, Err(String) carrying a human-readable explanation when parsing fails, following this chapter's divide example shape directly. input.trim().parse::() attempts the actual conversion, itself returning a Result — trim() first removes any accidental whitespace. The inner match translates parse's own generic error (which the function doesn't need to expose directly) into this function's own clearer, custom error message via format!, rather than just passing along parse's internal error type. Calling parse_age with "30" produces Ok(30), handled by the first match arm; calling it with "not a number" produces an Err with a message identifying exactly which input failed, handled by the second arm — both outcomes are handled explicitly, with no possibility of silently ignoring the failure case.