# Logic and arithmetic operators

The built-in scripting language supports the following logic and arithmetic operators.

## Logic operators

Operator Usage Description
AND A AND B TRUE if A and B are both TRUE
OR A OR B TRUE if A is TRUE, or B is TRUE, or both
XOR A XOR B TRUE if A is TRUE, or B is TRUE, but not both
NOT NOT A TRUE if A is FALSE
= X = Y TRUE if X is equal to Y
> X > Y TRUE if X is greater than Y
>= X >= Y TRUE if X is greater than or equal to Y
< X < Y TRUE if X is less than Y
<= X <= Y TRUE if X is less than or equal to Y
<> X <> Y TRUE if X is not equal to Y
& X & Y Bitwise AND:
```	0101 (decimal 5)
AND 0011 (decimal 3)
= 0001 (decimal 1)
```
| X | Y Bitwise OR:
```	0101 (decimal 5)
OR 0011 (decimal 3)
= 0111 (decimal 7)
```
^ X ^ Y Bitwise XOR:
```	0101 (decimal 5)
XOR 0011 (decimal 3)
= 0110 (decimal 6)
```
~ ~ X Bitwise NOT:
```NOT 0101 (decimal 5)
= 1010 (decimal 10)
```
>> n X >> Y Rotate n bits to right:
```	0110 (decimal 6) ROTATE RIGHT
= 0011 (decimal 3)
```
<< n X << Y Rotate n bits to left:
```	0110 (decimal 6) ROTATE LEFT
= 1100 (decimal 12)
```
Tip: For more complex logic, try the Logical and Loop functions.

## Arithmetic operators

Operator Usage Description
+ X + Y Add (plus)
- X - Y Subtract (minus)
* X * Y Multiply by
/ X / Y Divide by
Arithemtic operators are resolved from left to right according to the standard order of evaluation. To change the order, enclose in parentheses the part of the equation to be resolved first. For example, the following equation produces a result of 11 because multiplication is evaluated before addition; the equation multiplies 2 by 3 and then adds 5 to the result:
```5+2*3
```
In contrast, if you use parentheses to change the syntax, 5 and 2 are added together and then multiplied by 3 to produce 21:
```(5+2)*3
```
Tip: For more complex math, try the Arithmetic, Statistical, Logarithmic and Trigonometric functions.