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
Operators
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 {considering case | ignoring case}
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
Operators
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 --> True
Is Less Than
, <
, Comes Before
, Is Not Greater Than or Equal To
, Is Earlier Than
Operators
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 considering case
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
Operators
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
Operators
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
Operators
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
Operators
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 ...