Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next |
What is the need for Operators?
Operators in VB Script are to used to perform some operations or do some manipulation on variables or values. Operator is a notation to perform operation and this operation will happen on one or more operands.
Operators in VB script can be classified in to mainly four. They are
- Arithmetic Operators.
- Logical Operators.
- Relational or Comparison Operators.
- Concatenation Operator.
VB Script – Arithmetic Operators
Arithmetic operators are used for arithmetic operations or mathematical operations such as Addition, Subtraction, Multiplication and other kinds of operations.
- Please find the list of Operators with some examples for easy understanding.
Operator | English Meaning | Example | Result |
---|---|---|---|
+ | Add | 5+2 | 7 |
- | Subtract | 5-2 | 3 |
* | Multiply | 5*2 | 10 |
/ | Floating Point Division | 5/2 | 2.5 |
\ | Integer Division | 5\2 | 2 |
^ | Exponent | 5^2 | 25 |
Mod | Modulus | 5 Mod 2 | 1 |
Logical Operators
Logical operators are used to perform logical operations. They are used to manipulate statements or create logical expressions. The Logical operators are AND, OR and NOT.
- Please find the list of Operators with some examples for easy understanding.
Operator | English Meaning | Example | Result |
---|---|---|---|
Not | Inverts Value | Not False | True |
Or | Either Can Be True | True or False | True |
And | Both Must Be True | True And False | False |
Relational or Comparison Operators
Relational operators are also called as comparative operators like if we want to compare numbers etc. Generally they are used in conditional statements like IF Else or While loops.
- Please find the list of Operators with some examples for easy understanding.
Operator | English Meaning | Example | Result |
---|---|---|---|
= | Equal To | 20 = 45 | False |
> | Greater Than | 20 > 45 | False |
< | Less Than | 20 <> | True |
>= | Greater Than or Equal To | 20 >= 45 | False |
<= | Less Than or Equal To | 20 <= 45 | True |
<> | Not Equal To | 20 <> 45 | True |
Concatenation Operator
In order to combine two strings and display as a single string we use Concatenation Operator (&). We use “&” to join two expressions.
No comments:
Post a Comment