Operators in VB Script

1) Arithmetic operators:

Operator
Description
Example

+
Addition - Add values on either side of the operator.         

              If  a=10 and B=20 then
a + b will give 30


_
Subtraction - Subtracts right hand operand from    left hand operand

              If  a=10 and B=20 then

a - b will give -10


*
Multiplication - Multiplies values on either side of Operator           

              If  a=10 and B=20 then
a * b will give 200


/
Division - Divides left hand operand by right hand  operand

              If  a=10 and B=20 then

b/a=2


%
Modulus - Divides left hand operand by right hand  operand and returns remainder
b % a will give 0




2) Comparison Operators:

=
Checks if the values of two operands are equal or not, if yes then condition becomes true. If  a=10 and B=20 then
(A=B) is not true


!=
Checks if the values of two operands are equal or
not, if values are not equal then condition becomes
true.
(A! =B) is true.


<> 
Checks if the values of two operands are equal or
not, if values are not equal then condition becomes
true.
(A<>B) is true


Checks if the value of left operand is greater than
the value of right operand, if yes then condition
becomes true.
(A > B) is not true.


Checks if the value of left operand is less than the
value of right operand, if yes then condition
becomes true.
(A < B) is true.


>=
Checks if the value of left operand is greater than
or equal to the value of right operand, if yes then
condition becomes true.
(A >= B) is not true.


<=
 Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.
(A <= B) is true.


!<
Checks if the value of left operand is not less than
the value of right operand, if yes then condition
becomes true.
(A! < B) is false.


!>
Checks if the value of left operand is not greater
than the value of right operand, if yes then
condition becomes true.
(A! > B) is true.





No comments:

Post a Comment