Comparison Operators

These operators are used to compare values. Comparison options include equivalency, greater than and less than, and whether or not a value falls between a pair of other values.

is , are , = , equals , equal to , is equal to , does equal, are equal, the same

Behavior: Compares two values for equality, yielding either true or false. If both values are valid as numbers, a numeric comparison is performed. Otherwise a textual comparison is made. Ordinarily, textual comparisons are not case-sensitive. To force a case-sensitive comparison, use the considering case option, or set the caseSensitive property to true (see Case Sensitivity for more information). The default operation when comparing strings with the is operator is to ignore case differences. The terms with and without can be used in place of considering and ignoring.

When two numeric values are being compared, they will evaluate as equal if the difference between them is less than 0.00000000001 in order to accommodate small inaccuracies which may creep in during calculations.

When the two operands are both of the same internal type, such as date/time values, lists, property lists, or trees, the values will be compared directly according to the rules for that type of value. Use the as operator (or related functions) to explicitly control the type of comparison that is performed (see the as operator or more details).

Syntax:

operand1 is operand2 {considering case | ignoring case}

val1 and val2 are equal

Example:

if answer = 7 then ...

Example:

if name is "sarah" then ...

Example:

if prefix is "Mac" considering case then ...

Example:

put 5 * 3 and 15 are equal -- True

Example:

put 5 * 3 is the same as 15 --True

is not , are not , <> , does not equal , is not equal to , isn't , aren't, aren't equal, doesn't equal, isn't equal to, isn't the same, are not the same

Behavior: Compares two values for inequality, yielding either true or false. If both values are valid as numbers, a numeric comparison is performed. Otherwise a textual comparison is made. Ordinarily, textual comparisons are not case-sensitive. To force a case-sensitive comparison, use the considering case option (see Case Sensitivity for more information).

The default operation when comparing strings with the is not operator is to ignore case differences. The terms with and without can be used in place of considering and ignoring. When two numeric values are being compared, they will evaluate as unequal if the difference between them is greater than 0.00000000001 in order to accommodate small inaccuracies which may creep in during calculations.

When the two operands are both of the same internal type, such as date/time values, lists, property lists, or trees, the values will be compared directly according to the rules for that type of value. Use the as operator (or related functions) to explicitly control the type of comparison that is performed (see the as operator or more details).

Syntax:

operand1 is not operand2 {considering case | ignoring case}

Example:

if answer is not 7 then ...

Example:

if name isn't "sarah" then ...

Example:

if prefix is not "Mac" considering case then ...

Example:

put "CAT" and "cat" aren't equal considering case --True

Example:

put "cat" and "dog" are not the same --True

Example:

put 4 + 6 isn't the same as 2 * 12

is less than , < , comes before , is not greater than or equal to , is earlier than

Behavior: Compares whether a value is less than another, yielding either true or false. If both values are valid as numbers, a numeric comparison is performed. Otherwise a textual comparison is made. Ordinarily, textual comparisons are not case-sensitive. To force a case-sensitive comparison, use the consideringcase option, or set the caseSensitive property to true.

The default operation when comparing strings with the less than operator is to ignore case differences. The terms with and without can be used in place of considering and ignoring.

When the two operands are both of the same internal type, such as date/time values, lists, property lists, or trees, the values will be compared directly according to the rules for that type of value. Use the as operator (or related functions) to explicitly control the type of comparison that is performed (see the as operator or more details).

Syntax:

operand1 {is} less than operand2 {considering case | ignoring case}

Example:

if answer < 7 then ...

Example:

if name comes before "Beetle" then ...

Example:

if prefix is less than "Mac" ignoring case then ...

is greater than, > , is more than, comes after, is not less than or equal to, is later than, is past

Behavior: Compares whether a value is greater than another, yielding either true or false. If both values are valid as numbers, a numeric comparison is performed. Otherwise a textual comparison is made. Ordinarily, textual comparisons are not case-sensitive. To force a case-sensitive comparison, use the considering case option, or set the caseSensitive property to true.

The default operation when comparing strings with the greater than operator is to ignore case differences. The terms with and without can be used in place of considering and ignoring.

When the two operands are both of the same internal type, such as date/time values, lists, property lists, or trees, the values will be compared directly according to the rules for that type of value. Use the as operator (or related functions) to explicitly control the type of comparison that is performed (see the as operator or more details).

Syntax:

operand1 is greater than operand2 {considering case | ignoring case}

Example:

if answer > 7 then ...

Example:

if name comes after "Hannibal" then ...

Example:

if prefix is greater than "Mac" ignoring case then ...

is less than or equal to , <= , does not come after , is not greater than , is not later than, is at most, is no more than, is not past

Behavior: Compares whether a value is less than or equal to another, yielding either true or false. If both values are valid as numbers, a numeric comparison is performed. Otherwise a textual comparison is made. Ordinarily, textual comparisons are not case-sensitive. To force a case-sensitive comparison, use the considering case option, or set the caseSensitive property to true.

The default operation when comparing strings with the less than or equal to operator is to ignore case differences. The terms with and without can be used in place of considering and ignoring.

When the two operands are both of the same internal type, such as date/time values, lists, property lists, or trees, the values will be compared directly according to the rules for that type of value. Use the as operator (or related functions) to explicitly control the type of comparison that is performed (see the as operator or more details).

Syntax:

operand1 <= operand2 {considering case | ignoring case}

Example:

if answer <= 8 then ...

Example:

if name does not come after "Frank" then ...

Example:

if the number of items in guestList is no more than 12 then ...

Example:

if prefix is not greater than "Mac" considering case then ...

is greater than or equal to , >= , does not come before , is not less than , is not earlier than, is at least, is no less than

Behavior: Compares whether a value is greater than or equal to another, yielding either true or false. If both values are valid as numbers, a numeric comparison is performed. Otherwise a textual comparison is made. Ordinarily, textual comparisons are not case-sensitive. To force a case-sensitive comparison, use the considering case option, or set the caseSensitive property to true.

The default operation when comparing strings with the greater than or equal to operator is to ignore case differences. The terms with and without can be used in place of considering and ignoring.

When the two operands are both of the same internal type, such as date/time values, lists, property lists, or trees, the values will be compared directly according to the rules for that type of value. Use the as operator (or related functions) to explicitly control the type of comparison that is performed (see the as operator or more details).

Syntax:

operand1 >= operand2 {considering case | ignoring case}

Example:

if answer >= 7 then ...

Example:

if name does not come before "Zoo" then ...

Example:

if customer's age is at least 17 then admitToRMovie

Example:

if prefix is not less than "Mac" considering case then ...

between , is between , is not between , comes between , does not come between

Behavior: Tests whether a given value falls or does not fall within a pair of other values, yielding either true or false. The between operator is equivalent to "value >= lowEndValue and value <= highEndValue". The tested value is compared to both end values. If it falls between them, or is equal to either end value, the result is true. The end values of the range may be specified in ascending or descending order.

The value being tested is compared to both of the "end values". If it is equal to either end value, or is both greater than one and less than the other, then the between expression evaluates to true. Otherwise, it evaluates to false. EndValue1 may be greater or less than endValue2. Internally, the tested value is compared to each end value independently, so it is possible that different types of comparisons may be used for each (numeric for one and textual for the other, for example).

If both end values are valid as numbers, a numeric comparison is performed. Otherwise a textual comparison is made. Ordinarily, textual comparisons are not case-sensitive. To force a case-sensitive comparison, use the considering case option, or set the caseSensitive property to true.

Syntax:

value {is} {not} between endValue1 and endValue2 {considering case | ignoring case}

value [comes between | does {not} come between] endValue1 and endValue2 {considering case | ignoring case}

Example:

if answer is between 7 and 11 then ...

Example:

if wd does not come between "Zoo" and "Zygote" ignoring case then ...

Example:

if height is between minAllowedHeight and maxAllowedHeight then ...

 

This topic was last updated on June 21, 2019, at 02:49:49 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant