Using Director > Writing Scripts with Lingo > Using operators to manipulate values > Arithmetic operators |  |

Arithmetic operators

Arithmetic operators add, subtract, multiply, divide, and perform other arithmetic operations. Parentheses and the minus sign are arithmetic operators.

Operator | Effect | Precedence
--- | --- | ---
( ) | Groups operations to control precedence order. | 5
- | When placed before a number, reverses the sign of a number. | 5
* | Performs multiplication. | 4
mod | Performs modulo operations. | 4
/ | Performs division. | 4
+ | Performs addition. | 3
- | When placed between two numbers, performs subtraction. | 3

Note: When only integers are used in an operation, the result is an integer. Using integers and floating-point numbers in the same calculation results in a floating-point number.

When dividing one integer by another doesn't result in a whole number, Lingo rounds the result down to the nearest integer. For example, the result of `4/3` is `1`.

To force Lingo to calculate a value without rounding the result, use `float()` on one or more values in an expression. For example, the result of `4/float(3)` is 1.333.