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 ...