如何检查是否一个数是另外两个数字之间的ActionScript 3的?

如何检查是否一个数是另外两个数字之间的ActionScript 3的?

问题描述:

我怎么能检查一个数字是其他两个数字之间,如:

How can i check if a number is between two other numbers like:

伪code:

var = 458;

if (var is between 0 and 1000) give positive.

if (var is between 1001 and 2000) give negative.

if (var is between 2001 and 3000) give negative.

在AS3?

在此先感谢。

如果您将检查过很多次,只需创建功能:

If You will check it many times, simply create function :

function check(min:Number , value:Number , max:Number):Boolean{
    return min > value ? false : ( max < value ? false : true );
}

这将返回true,如果值的最小值和最大值之间。

It will return true if value is between min and max.