To control the VB program flow, we can use various conditional operators. Basically, they resemble mathematical operators. Conditional operators are very powerful tools, they let the VB program compare data values and then decide what action to take, whether to execute a program or terminate the program and etc.
These operators are shown below
Operator |
Meaning
|
= |
Equal to
|
> |
More than
|
< |
Less Than
|
>= |
More than and equal
|
<= |
Less than and equal
|
<> |
Not Equal to
|
Conditional Operators
* You can also compare strings with the above operators. However, there are certain rules to follows:
Upper case letters are less than lowercase letters,
- "A"<"B"<"C"<"D".......<"Z" and
- numbers are less than letters.
So the following test would be true and the branch taken to LessThan
Name1 = "ARt"
Name2 = "Art"
IF Name1 < Name2 then goto LessThen
similarly
Name1 = "1ART"
Name2 = "ART"
IF Name1 < Name2 then goto LessThan