| << 4.3.1- Assignment Operator | Chapter4 | 4.3.3- Arithmetic Calculations >> |
Comparison Operators
The comparison operators are used slightly differently. The comparison operators available in VBScript are:
|
Equality |
= |
Inequality |
<> |
|
Less than |
< |
Greater than |
> |
|
Less than or equal to |
<= |
Greater than or equal to |
>= |
We've just seen the 'equal' sign (=) in its guise as the assignment operator. In this case, the 'equal' sign is used as the equality operator, to test for equality:
If Number1 = 2 Then
This statement says, "If the value inside Number1 is already equal to 2 then (perform a certain operation)". It depends upon the context in which the equals sign is used. If it's used on its own, then it assigns one value to a variable, if it's used as part of an If ... Then statement, then it's being used as a comparison operator. You can also use these operators to compare the values of two operands – such as variables or expressions. The result of the comparison is a Boolean value – that is, either TRUE or FALSE.
We'll be looking at exactly how the If ... Then structure works in the next chapter .
| << 4.3.1- Assignment Operator | Chapter4 | 4.3.3- Arithmetic Calculations >> |

RSS
