Does Actionscript have a built-in function that accepts a number and can return a Boolean if this number is between 2 numbers.
For example
3 is between 2 and 6 //returns true
5 is between 10 and 20 //returns false
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, but you can easily code one yourself:
public static function isBetween(x : Number, low: Number, high : Number) : Boolean { return ((x>=low)&&(x<=high)); }So, for your example, isBetween(3,2,6) returns true and isBetween(5,10,20) returns false. That said, simply using the boolean expression ((x>=2)&&(x<=6)) is much more readable than isBetween(x,2,6).