EqualNumber

The asdk.condition.EqualNumber class tests for the condition of equal numbers. It is animplementation of the BinaryCondition interface that compares two operands and determines whether the first operand is equal the second operand. In the example below several comparisons are made between numbers to demonstrate the usage of this condition:

1
2
3
4
5
6
7
8
9
10
11
12
13
var equalNumber : asdk.condition.BinaryCondition = new asdk.condition.EqualNumber();

var isTwoEqualToOne = equalNumber.execute( 2, 1 );
trace("isTwoEqualToOne: " + isTwoEqualToOne );
//displays isTwoEqualToOne: false in output window

var isTwoEqualToTwo = equalNumber.execute( 2, 2 );
trace("isTwoEqualToTwo: " + isTwoEqualToTwo );
//displays isTwoEqualToTwo: true in output window

var isTwoEqualToThree = equalNumber.execute( 2, 3 );
trace("isTwoEqualToThree: " + isTwoEqualToThree );
//displays isTwoEqualToThree: false in output window

In this example, the first operand of 2 is only equal than the second operand in the second case on line 7. The other comparisons return false when 2 is compared to 1 (line 3) and when 2 is compared to 3 (line 11).

Although this class is typically used to test how numbers relate to each other, Strings can also be passed into the execute method to determine if they are equal.