8.8.15 Comparison operators (=, <>, <, <=, >, >=) (compare two expressions)
- Purpose
-
Compares two expressions.
- Syntax
Result = Expression1 comparison-operator Expression2
- Arguments
-
- Result
-
Specify a variable for storing the comparison result.
- Expression1
-
Write any expression.
- Expression2
-
Write any expression.
- comparison-operator
-
Specify a comparison operator.
- Description
-
The comparison operators compare two expressions. Each operator returns a True or False result according to the following conditions:
- = (equal)
-
True condition: Expression1 = Expression2
False condition: Expression1 <> Expression2
- <> (not equal)
-
True condition: Expression1 <> Expression2
False condition: Expression1 = Expression2
- < (less than)
-
True condition: Expression1 < Expression2
False condition: Expression1 >= Expression2
- <= (less than or equal)
-
True condition: Expression1 <= Expression2
False condition: Expression1 > Expression2
- > (greater than)
-
True condition: Expression1 > Expression2
False condition: Expression1 <= Expression2
- >= (greater than or equal)
-
True condition: Expression1 >= Expression2
False condition: Expression1 < Expression2
The datatypes of the expressions determine the type of comparison performed and the result, as follows:
Condition
Operation performed
Both expressions are numeric datatypes.
Numeric comparison
Both expressions are string datatypes.
String comparison#
One expression is a numeric datatype, and the other is a string datatype.
String comparison#
One expression is an Empty value, and the other is a numeric datatype.
Numeric comparison with the Empty value taken as zero except in equality comparisons.
One expression is an Empty value, and the other is a string datatype.
String comparison with the Empty value taken as a zero-length string ("").#
Both expressions are Empty values.
The two expressions are considered to be equal.
- JP1/Script version
-
Supported from JP1/Script 01-00.