Skip to main content

Practice ยท 3 of 4

Closures: counter factory

CHALLENGE
Difficulty: beginner+25 XP

Implement static (Func<int> Next, Action Reset) MakeCounter(int start) โ€” Next() returns the current value then increments; Reset() restores the value to start. Each call to MakeCounter must produce an INDEPENDENT counter.

Back to lesson: Practice: Delegates workout