Arithmetic Operator
The following table illustrates the description and symbols of arithmetic operators:
Table 11-2 Arithmetic Operators
Description | Symbols |
---|---|
Exponentiation | ^ |
Unary Negation Or Subtraction | - |
Multiplication | * |
Division | / |
Integer division | \ |
Modulus Arithmetic | Mod |
Addition | + |
String Concatenation | & |
The following few examples illustrates the use of the arithmetic operators:
Example 1:
Dim Positive, Negative
Positive = 5
Negative = -Positive ' Unary Negation: -5
Example 2:
Dim Dividend, Divisor, IntQuotient
Dividend = 20
Divisor = 3
IntQuotient = Dividend \ Divisor ' Integer Division: 20 \ 3
'20 \ 3 = results 6