Comparison Operators : VBScript
VBScript Comparison Operators :
Following is the list of Comparison Operators supported by VBScript. Consider that A = 10 and B = 20
Operator | Description | Example |
---|---|---|
== | Checks if the value of two operands are equal or not | A == B |
<> | Checks if the value of two operands are equal or not | A <> B |
> | Checks if the value of left operand is greater than the value of right operand | A > B |
< | Checks if the value of left operand is less than the value of right operand | A < B |
>= | Checks if the value of left operand is greater than or equal to the value of right operand | A >= B |
<= | Checks if the value of left operand is less than or equal to the value of right operand | A <= B |
Comparison Operators Example :
<!DOCTYPE html> <html> <body> <script language="vbscript" type="text/vbscript"> Dim a = 10 Dim b = 20 Dim c If a=b Then Document.write ("Operator Line 1 : True") Document.write ("<br />") Else Document.write ("Operator Line 1 : False") Document.write ("<br />") End If If a<>b Then Document.write ("Operator Line 2 : True") Document.write ("<br />") Else Document.write ("Operator Line 2 : False") Document.write ("<br />") End If If a>b Then Document.write ("Operator Line 3 : True") Document.write ("<br />") Else Document.write ("Operator Line 3 : False") Document.write ("<br />") End If If a<b Then Document.write ("Operator Line 4 : True") Document.write ("<br />") Else Document.write ("Operator Line 4 : False") Document.write ("<br />") End If If a>=b Then Document.write ("Operator Line 5 : True") Document.write ("<br />") Else Document.write ("Operator Line 5 : False") Document.write ("<br />") End If If a<=b Then Document.write ("Operator Line 6 : True") Document.write ("<br />") Else Document.write ("Operator Line 6 : False") Document.write ("<br />") End If </script> </body> </html>
Output :
Operator Line 1 : False Operator Line 2 : True Operator Line 3 : False Operator Line 4 : True Operator Line 5 : False Operator Line 6 : True