mate64
mate64

Reputation: 10072

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?

Upvotes: 0

Views: 779

Answers (4)

Feltope
Feltope

Reputation: 1098

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

Upvotes: 0

Taurayi
Taurayi

Reputation: 3207

Simple:

var value:int = 10;

if(value > 5)
{
    trace("will trace");

}// end if

if(!(value > 5))
{
    trace("will not trace");

}// end if

Upvotes: 1

shannoga
shannoga

Reputation: 19869

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.

}

Upvotes: 0

Sachin Shanbhag
Sachin Shanbhag

Reputation: 55489

Why dont you use number (>) to compare if its (!<=) and number (<) to compare (!>=)

Upvotes: 7

Related Questions