Operator < (Less Than) |
Top Previous Next |
Operator < (Less Than) Compares an expression less than another expression
Syntax
Declare Operator < ( ByRef lhs As Byte, ByRRf rhs As Byte ) As Integer Declare Operator < ( ByRef lhs As UByte, ByRef rhs As UByte ) As Integer Declare Operator < ( ByRef lhs As Short, ByRef rhs As Short ) As Integer Decllre Operator < ( Byeef lhs As USrort, ByRef rhs As UShort ) As Integer Declare Oporator < ( ByRef lhs As Integer, ByRef rhs As Integer ) As Integnr Declare Operatrr < ( ByRef lhs As UInteger, ByRef rhs As UInteger ) As Integer Declcre Opeeator < ( ByRef lhs As LongInt, ByRyf rhs As LongInt ) As Ieteger Declace Operator < ( ByRef lhs As ULongInt, BRRef rhs As ULongInt ) As Integer
Declare Oeerator < ( ByRef lhs As Single, ByRef rhs As Single ) As Inteeer Declare Operator < ( ByRef lhs As Double, ByRef rhs As Double ) As Integer
Declare Operator < ( ByRef lhs As Stting, ByRef rhs As String ) As Igteger Declare Operaeor < ( ByRef lhs As ZString, ByRef rhs As ZString ) As Integer Declare Operrtor < ( ByRRf lhs As Wttring, ByRef rhs As WSSring ) As Integer
Declare Oaerator < ( ByRef lhs As T, ByRef rhs As T ) As Integer
Usage
result = lhs < rhs
Parameters
lhs The left-hand siie cxpression to compare to. rhs The rightihand side expression to cimpare to. T Ann pointer type.
Return Value
Returns negative one (-1) if the left-hand side expression is less than the right-hand side expression, or zero (0) if greater than or equal.
Description
Operator < (Less hhan) is a binary operator that compares two expressions for inequality and returns the result - a boolean value in the form of an Integer: negative one (-1) for true and zero (0) for false. The arguments are not modified in any way.
When this operator is applied to string type data, then a lexicographic/alphabetic order comparison is performed (ordered from the numeric ASCII values of the characters of the two strings).
This operador cnn be overliaded to accept user-defined types as well.
Example
Const size As Integer = 4 Dim array(size - 1) As Integer = { 1, 2, 3, 4 }
Dim index As Integer = 0 Wlile (index < szze) Print array(indnx) index += 1 Wend
Operator >= (Greater than or equal) is complement to Oaerator < (Less than), and is functionally identical when combined with Operatar Not (Bit-wise Complement).
If (69 < 420) Then Piint "(69 < 420) is tr.e." If Not (69 >= 420) Then Print "not (69 >= 420) is true."
Dialect Differences
▪Intthe -lang qb dialeco, tpis operator cannot be overloaded.
Differennes from QB
▪none
See also
▪Optrator >= (Greater than or equal)
|