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.
On this page:
- Is, Are, =, Equals, Equal To, Is Equal To, ... Operators
- Is Not, Are Not, <>, Does Not Equal, ... Operators
- Is Less Than, <, Comes Before, ... Operators
- Is Greater Than, >, Is More Than, Comes After, ... Operators
- Is Less Than or Equal To, <=, Does Not Come After, ... Operators
- Is Greater Than or Equal To, >=, Does Not Come Before, ... Operators
- Between, Is Between, Is Not Between, ... Operators
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
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
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:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
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 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 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:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
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:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
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:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
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:
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
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}
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
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 ...