## Operators

Operator Precedence

LevelOperators
1unary -, unary +
2*, /
3MOD
4+, -
5&
6<<, >>
7=, <, >, <=, >=, <>
8NOT
9AND, ANDALSO
10OR, ORELSE
11XOR

Operators at level one have the highest precedence, with operators at level seven having the lowest precedence. Parentheses can be used to override the order of precedence rules, allowing parts of an expression to be evaluated before others.

Relational Operators

The operators used for comparison are called relational operators. Applying a relational operator will yield a result of true or false.

 Operator Meaning = Is equal to < Is less than > Is greater than <= Is less than or equal to >= Is greater than or equal to <> Is not equal to

The only relational operators supported for string types are equal and not equal, unless the string is being compared against nothing., in which case "is" and "isnot" may be used. Because the internal binary representation of floating point numbers may not be exact, the equality operator should be avoided for floating point numbers.

Mathematical Operators

 Operator Meaning * Multiply / Divide + Addition - Subtraction MOD Modulus

In addition to the mathematical operators shown above, you can use the unary operator to change the sign. For example,

```Sub Main()
Dim Value As SByte
Value = 10     ' Value = 10
Value = -Value ' Value = -10
End Sub
```

Logical Operators

 Operator Meaning NOT Negate AND Logical AND OR Logical OR XOR Logical XOR

Logical operators can be used to build conditional expressions, for example, when using ifthen, whileend while and dorepeat until statements. Applying a boolean operator yields either true or false.

Bitwise Operators

The following operators perform bitwise manipulation on integer operands.

 Operator Meaning NOT A bitwise NOT or complement AND Bitwise AND OR Bitwise OR XOR Bitwise XOR << Shift Left >> Shift Right