LOTUSSCRIPT LANGUAGE
Syntax
expr1 operator expr2
Elements
expr1, expr2
An expression consisting of two numeric operands and a relational (comparison) operator evaluates to True (-1), False (0), or, if either or both of the operands is NULL, to NULL.
For a description of the way in which LotusScript treats the values True (-1) and False (0), see "Boolean values" in the chapter "Data Types, Constants, and Variables".
Comparing two expressions, neither of which is NULL, returns the following values:
LotusScript interprets the relational operator as either numeric comparison or string comparison, depending on the data types of expr1 and expr2. The following table lists these interpretations. The numeric data types are Integer, Long, Single, Double, Currency, and (in a Variant variable only) Date/Time.
For string comparison, the Option Compare statement sets the comparison method:
To compare strings, LotusScript examines the two strings character by character, starting with the first character in each string. The collating sequence values (positions in the character sort sequence) of the two characters are compared.
Data type conversion
When the operands in a comparison are of different data types, LotusScript automatically converts data types where possible to make the operands compatible before comparing them:
BOOLEAN
BYTE
INTEGER
LONG
SINGLE
DOUBLE
CURRENCY
Examples
This example compares numbers.
Print 1 < 2 ' Prints True Print 2 > 1 ' Prints True Print 1 <> 2 ' Prints True Print 2 >= 2 ' Prints True Print 2 <= 2 ' Prints True Print 2 = 2 ' Prints True
This example compares strings.
Print "hello" < "hellp" ' Prints True
Dim myVar As Variant, myStr As Variant myStr = "34" myVar = 34 Print myVar < myStr ' Prints True Print 45 > myStr ' Prints True Print "45" > myVar ' Prints True
This example compares two numbers in a more detailed manner:
anInt% = 10 anotherInt% = 15 Dim theResultV As Variant If anInt% > anotherInt% Then Print anInt% & " is greater than " & anotherInt% & "." Else Print anInt% & " is less than or equal to " & _ anotherInt% & "." End If ' Output: 10 is less than or equal to 15. theResultV = (anInt% > anotherInt%) Print theResultV ' Output: False Print CInt(anInt% > anotherInt%) ' Output: 0 Print (anInt% > anotherInt%) = False ' Output: True ' because the expression (anInt% > anotherInt%) = False ' is True.
See Also