Skip to main content

Practice · 1 of 3

Out Params: Assign Before You Return

CHALLENGE
Difficulty: intermediate+25 XP

Implement a Try-style parser for "left:right" where BOTH numbers must be strictly positive. On ANY failure (bad shape, unparseable part, non-positive value), return false and leave BOTH out params at 0 — out params carry data only on success. ``csharp static bool TryParsePair(string input, out int a, out int b); ``

Back to lesson: Practice: Parameter Passing Practice