Skip to main content

Practice · 1 of 4

ParseAge with layered validation

CHALLENGE
Difficulty: beginner+25 XP

Implement static int ParseAge(string input): null/whitespace → ArgumentException; not a number → FormatException; outside 0–150 → ArgumentOutOfRangeException; otherwise the parsed age.

Back to lesson: Practice: Error handling workout