constrain()

C 에디터 명령어 ›› Math ››
Parent Previous Next

숫자의 범위를 제한한다.


사용방법

constrain(num, a, b)


리턴값

num이 a보다 작을때 : a

num이 b보다 클때 : b

num이 a와 b 사이 : num


사용 예

sensVal = constrain(sensVal, 10, 150); // 변수의 범위가 10~150으로 제한된다

Created with the Personal Edition of HelpNDoc: News and information about help authoring tools and software