﻿ ﻿
﻿

Introduction to Numeric Comparison Operations

This section provides a quick introduction of numeric comparison operations supported by VBScript: Equal to, Not equal to, Greater than, Less than, Greater than or equal to, Less than or equal to.

﻿

Numeric comparison operations are operations that:

• Operates on two numeric operands.
• Produces a Boolean value by applying the comparison operation specified by the operator.

There are 6 numeric comparison operations supported in VBScript:

• Equal to (=): Resulting (True) if two operands are numerically equal.
• Not equal to (<>): Resulting (True) if two operands are numerically not equal.
• Greater than (>): Resulting (True) if the first operand is numerically greater than the second operand.
• Less than (<): Resulting (True) if the first operand is numerically less than the second operand.
• Greater than or equal to (>=): Resulting (True) if the first operand is numerically greater than or equal to the second operand.
• Less than or equal to (<=): Resulting (True) if the first operand is numerically less than or equal to the second operand.

To show you how numeric comparison operations work, I wrote the following script, comparison_operation.html:

```<html>
<body>
<!-- comparison_operation.html
- Copyright (c) 2015, HerongYang.com, All Rights Reserved.
-->
<pre>
<script language="vbscript">
document.writeln(1 = 1)
document.writeln(1 <> 1)
document.writeln(9.9999e-1 > 9.99999e-1)
document.writeln(9.9999e-1 < 1)
document.writeln(9.9999e-1 >= 0.99999)
document.writeln(1.00000001 <= 1)
</script>
</pre>
</body>
</html>
```

Here is the output of this VBScript example script:

```True
False
False
True
True
False
```

No surprises in the output. But the equal to operator sign (=) is identical to the assignment operator. We need to be careful.

﻿

﻿ ﻿

Table of Contents