Operator < (Less than)


Compares an expression less than another expression

Syntax:
Usage:
result = lhs < rhs

Parameters:
lhs
The left-hand side expression to compare to.
rhs
The right-hand side expression to compare to.
T
Any 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 than) 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 operator can be overloaded to accept user-defined types as well.

Examples:

Const size As Integer = 4
Dim array(size - 1) As Integer = { 1, 2, 3, 4 }

Dim index As Integer = 0
While (index < size)
   Print array(index)
   index += 1
Wend
Operator >= (Greater than or equal) is complement to Operator < (Less than), and is functionally identical when combined with Operator Not (Bit-wise Complement).

   If (69 < 420) Then Print "(69 < 420) is true."
   If Not (69 >= 420) Then Print "not (69 >= 420) is true."


Dialect Differences:
Differences from QB:
See also:
Back to Relational Operators
Back to Operators
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode