Is there a method to limit/clamp a number?

后端 未结 5 716
醉酒成梦
醉酒成梦 2021-01-01 10:51

I wrote the following code, which keeps x within the range (a..b). In pseudo code:

(if x < a, x = a; if x > b, x = b)
         


        
5条回答
提交回复
热议问题