How to check if value is not smaller (!<=) or bigger (!>=) than value x?
How to check if value is not smaller 开发者_开发百科(!<=) or bigger (!>=) than value x?
Why dont you use number (>)
to compare if its (!<=)
and number (<)
to compare (!>=)
Simple:
var value:int = 10;
if(value > 5)
{
trace("will trace");
}// end if
if(!(value > 5))
{
trace("will not trace");
}// end if
I assume that you are talking about 2 operations (other wise there is no such number). so you should use
if(number >=x){//which means he is larger.
}else if(number<=x){//which means he is smaller.
}
If x and y are both numbers then x <= y || x >= y one of them has to be true (or both if x == y). Using logical not in this fashion can make things less readable but you would do it like this.
x !>= y would actually need to be !(x >= y)
x >= y is the same as !(x <= y) x <= y is the same as !(x >= y)
Operators in AS3 from the live docs can be found at: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/operators.html
精彩评论