Logical Operators : VBScript

VBScript Comparison Operators :

Following is the list of Comparison Operators supported by VBScript. Consider that A = 10 and B = 20

OperatorDescription
ANDIf both the conditions are True then Expression becomes True.
ORIf any of the two conditions is True then condition becomes True.
NOTIt reverses the logical state of its operand. If a condition is True then the Logical NOT operator will make it False.
XORIt is the combination of NOT and OR Operator. If one and only one of the expressions evaluates to True then result is True.

Comparison Operators Example :

<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
  Dim a = 10
  Dim b = 0 
  Dim c
  If a<>0 AND b<>0 Then                    
     Document.write ("AND Operator Result is : True")
     Document.write ("<br />")
  Else
     Document.write ("AND Operator Result is : False")
     Document.write ("<br />")
  End If
  If a<>0 OR b<>0 Then
     Document.write ("OR Operator Result is : True")
     Document.write ("<br />")
  Else
     Document.write ("OR Operator Result is : False")
     Document.write ("<br />") 
  End If
  If NOT(a<>0 OR b<>0) Then
     Document.write ("NOT Operator Result is : True")
     Document.write ("<br />") 
  Else
     Document.write ("NOT Operator Result is : False")
     Document.write ("<br />") 
  End If
  If (a<>0 XOR b<>0) Then
     Document.write ("XOR Operator Result is : True")
     Document.write ("<br />") 
  Else
     Document.write ("XOR Operator Result is : False")
     Document.write ("<br />") 
  End If
</script>
</body>
</html>

Output :

AND Operator Result is : False
OR Operator Result is : True
NOT Operator Result is : False
XOR Operator Result is : True