Skip to main content

Practice ยท 2 of 4

Clamp to a range

CHALLENGE
Difficulty: beginner+25 XP

Implement static int Clamp(int value, int min, int max) โ€” return value when it lies within [min, max], otherwise the boundary it crossed. Both boundaries must be enforced.

Back to lesson: Practice: Method workshop