Comparison Operator

The following table illustrates the description and symbols of comparison operators:

Table 11-4 Comparison Operators

Description Symbols
Equality =
Inequality <>
Less than <
Greater than >
Less than or equal to <=
Greater than or equal to >=

The following examples illustrate the use of the comparison operators:

Example 1:

Dim A, B, IsNotEqual
A = 10
B = 20
IsNotEqual = (A <> B)   ' Inequality: A <> B
'IsNotEqual: A does not equal B: True

Example 2:

Dim A, B, IsLessThan
A = 10
B = 20
IsLessThan = (A < B)   ' Less than: A < B
'IsLessThan: A is less than B: True

Example 3:

Dim A, B, IsGreaterThan
A = 20
B = 10
IsGreaterThan = (A > B)   ' Greater than: A > B
'IsGreaterThan: A is greater than B: True

Example 4:

Dim A, B, IsLessThanOrEqual
A = 10
B = 10
IsLessThanOrEqual = (A <= B)   ' Less than or equal to: A <= B
'IsLessThanOrEqual: A is less than or equal to B: True