clamp method

int clamp(
  1. int v
)

Implementation

int clamp(int v) => v < lo ? lo : (v > hi ? hi : v);