Is there a “canonical” name for a function combining min() and max()?

后端 未结 8 2087
孤街浪徒
孤街浪徒 2021-02-18 13:03

I find that I frequently end up writing a function that I always call \"clamp()\", that is kind of a combination of min() and max(). Is t

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-18 13:47

    What about bound?

    bound(min, val, max)
    

    Or constrain?

    constrain(val, min, max)
    

提交回复
热议问题