Syntax 

^ Not * / \ Mod + - << >> & < <= > >= = <> Is IsNot

And AndAlso Or OrElse Xor Eqv Imp


Description 

These operators are available for numbers n1 and n2 or strings s1 and s2. If any value in an expression is Null then the expression's value is Null. The order of operator evaluation is controlled by operator precedence.


Operator

Description

- n1 

Negate n1.

n1 ^ n2 

Raise n1 to the power of n2.

n1 * n2 

Multiply n1 by n2.

n1 / n2 

Divide n1 by n2.

n1 \ n2 

Divide the integer value of n1 by the integer value of n2.

n1 Mod n2 

Remainder of the integer value of n1 after dividing by the integer value of n2.

n1 + n2 

Add n1 to n2.

s1 + s2 

Concatenate s1 with s2.

n1 - n2 

Difference of n1 and n2.

n1 << n2 

Shift n1 by n2 bits to the left. The number of bits to shift is indicated by the lowest bits of n2: lowest 3 bits when n1 is a SByte/Byte value, lowest 4 bits when n1 is a Integer/UInteger value, lowest 5 bits when n1 is a Long/ULong value, lowest 6 bits when n1 is a Huge_/UHuge_ value. This language element is not VBA compatible.

n1 >> n2 

Shift n1 by n2 bits to the right. The number of bits to shift is indicated by the lowest bits of n2: lowest 3 bits when n1 is a SByte/Byte value, lowest 4 bits when n1 is a Integer/UInteger value, lowest 5 bits when n1 is a Long/ULong value, lowest 6 bits when n1 is a Huge_/UHuge_ value. (For signed numbers the sign bit is propagated to the right.) This language element is not VBA compatible.

s1 & s2 

Concatenate s1 with s2.

n1 < n2 

Return True if n1 is less than n2.

n1 <= n2 

Return True if n1 is less than or equal to n2.

n1 > n2 

Return True if n1 is greater than n2.

n1 >= n2 

Return True if n1 is greater than or equal to n2.

n1 = n2 

Return True if n1 is equal to n2.

n1 <> n2 

Return True if n1 is not equal to n2.

s1 < s2 

Return True if s1 is less than s2.

s1 <= s2 

Return True if s1 is less than or equal to s2.

s1 > s2 

Return True if s1 is greater than s2.

s1 >= s2 

Return True if s1 is greater than or equal to s2.

s1 = s2 

Return True if s1 is equal to s2.

s1 <> s2 

Return True if s1 is not equal to s2.

Not n1 

Bitwise invert the integer value of n1. Only Not True is False.

n1 And n2 

Bitwise and the integer value of n1 with the integer value n2.

n1 AndAlso n2 

Logical and of n1 with the n2. If n1 is False, n2 is not evaluated. This language element is not VBA compatible..

n1 Or n2 

Bitwise or the integer value of n1 with the integer value n2.

n1 OrElse n2 

Logical or of n1 with the n2. If n1 is True, n2 is not evaluated. This language element is not VBA compatible.

n1 Xor n2 

Bitwise exclusive-or the integer value of n1 with the integer value n2.

n1 Eqv n2 

Bitwise equivalence the integer value of n1 with the integer value n2 (same as Not (n1 Xor n2)).

n1 Imp n2 

Bitwise implicate the integer value of n1 with the integer value n2 (same as (Not n1) Or n2).


Example

Sub Main

    N1 = 10

    N2 = 3

    S1$ = "asdfg"

    S2$ = "hjkl"

    Debug.Print -N1        '-10

    Debug.Print N1 ^ N2    ' 1000

    Debug.Print Not N1     '-11

    Debug.Print N1 * N2    ' 30

    Debug.Print N1 / N2    ' 3.3333333333333

    Debug.Print N1 \ N2    ' 3

    Debug.Print N1 Mod N2  ' 1

    Debug.Print N1 + N2    ' 13

    Debug.Print S1$ + S2$  '"asdfghjkl"

    Debug.Print N1 - N2    ' 7

    Debug.Print N1 << N2   ' 80

    Debug.Print N1 >> N2   ' 1

    Debug.Print N1 & N2    '"103"

    Debug.Print N1 < N2    'False

    Debug.Print N1 <= N2   'False

    Debug.Print N1 > N2    'True

    Debug.Print N1 >= N2   'True

    Debug.Print N1 = N2    'False

    Debug.Print N1 <> N2   'True

    Debug.Print S1$ < S2$  'True

    Debug.Print S1$ <= S2$ 'True

    Debug.Print S1$ > S2$  'False

    Debug.Print S1$ >= S2$ 'False

    Debug.Print S1$ = S2$  'False

    Debug.Print S1$ <> S2$ 'True

    Debug.Print N1 And N2     ' 2

    Debug.Print N1 AndAlso N2 ' True

    Debug.Print N1 Or N2      ' 11

    Debug.Print N1 OrElse N2  ' True

    Debug.Print N1 Xor N2     ' 9

    Debug.Print N1 Eqv N2     ' -10

    Debug.Print N1 Imp N2     ' -9

End Sub