Introduction to Logical Operations

This section provides a quick introduction of logical operations supported by VBScript: logical negation - Not, conjunction - And, disjunction - Or, exclusion - Xor, equivalence - Eqv, implication - Imp.

Logical operations are operations that:

• Operates on one Boolean operand or two Boolean operands.
• Produces a Boolean value by applying the logical operation specified by the operator.

There are 6 logical operations supported in VBScript:

• Logical Conjunction (And): Resulting (True) if and only if both operands are (True).
• Logical Disjunction (Or): Resulting (True) if one of operands is (True).
• Logical Negation (Not): Resulting (True) if the operand is (False).
• Logical Exclusion (Xor): Resulting (True) if and only if one of operands is (True).
• Logical Equivalence (Eqv): Resulting (True) if and only if both operands have the same value.
• Logical Implication (Imp): Resulting (True) if the second operand is (True) or both operands are (False).

To show you how logical operations work, I wrote the following script, logical_operation.html:

```<html>
<body>
<!-- logical_operation.html
-->
<pre>
<script language="vbscript">
document.writeln(True And True)
document.writeln(True Or True)
document.writeln(Not True)
document.writeln(True Xor True)
document.writeln(True Eqv False)
document.writeln(True Imp False)
</script>
</pre>
</body>
</html>
```

Here is the output of this VBScript example script:

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

No surprises in the output. But logical equivalence operation and logical implication operation are not commonly used operations.