Caché Basic Reference
Comparison Operators
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Used to compare expressions.
Synopsis
result = expression1 comparisonoperator expression2
result = object1 Is object2
Arguments
Comparison operators have these parts:
result Any numeric variable.
expression Any expression.
comparisonoperator Any comparison operator.
object Any object name.
Description
The Is operator has specific comparison functionality that differs from the operators in the following table. The following table contains a list of the comparison operators and the conditions that determine whether result is True or False:
Operator Description True If False if
< Less than expression1 < expression2 expression1 >= expression2
<= Less than or equal to expression1 <= expression2 expression1 > expression2
> Greater than expression1 > expression2 expression1 <= expression2
>= Greater than or equal to expression1 >= expression2 expression1 < expression2
= Equal to expression1 = expression2 expression1 <> expression2
<> Not equal to expression1 <> expression2 expression1 = expression2
When comparing two expressions, you may not be able to easily determine whether the expressions are being compared as numbers or as strings.
The following table shows how expressions are compared or what results from the comparison, depending on the underlying subtype:
If Then
Both expressions are numeric Perform a numeric comparison.
Both expressions are strings Perform a string comparison.
One expression is numeric and the other is a string The numeric expression is less than the string expression.