METHOD
Math.Clamp (Int32)
Clamps an integer to inclusive bounds. Reject reversed bounds rather than silently swapping them.
Formal Syntax & Structure
csharp syntaxcsharp
Math.Clamp(value, min, max)Working Example
Example Snippetcsharp
using System;Console.WriteLine(Math.Clamp(18, 0, 10)); // 10