Less than

From Xojo Documentation

Revision as of 13:37, 26 January 2021 by PLefebvre (talk | contribs) (Changed deprecated StrComp to String.Compare.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Used to determine whether one quantitative or alphabetic expression is smaller than another. String comparisons are case-insensitive.


result = expression1 < expression2

Part Type Description
result Boolean Returns True if expression1 is less than expression2.
expression1 String, Number, or date Any alphabetic or quantitative expression.
expression2 String, Number, or date Any alphabetic or quantitative expression.


A string is "less than" another string if it is first when the two strings are sorted alphabetically. Use String.Compare to do a case-sensitive String comparison.

You can use Operator_Compare to define comparisons for classes.

Sample Code

This example uses the < operator to evaluate a and b.

Var a,b As Integer
If TextField1.Value <> "" and TextField2.Value <> "" Then
a = TextField1.Value.ToInteger
b = TextField2.Value.ToInteger
If a < b Then
MessageBox("A is Less Than B!")
End If
MessageBox("Please enter values into both boxes!")
End If

See Also

>, >=, <, <= =, <> operators; Operator_Compare, String.Compare functions; Operator precedence.