The following mathematical operators always convert the values they operate on (operands) to a numeric form. If any operand is a float then the return value will also be a float, otherwise the return value will be an integer. The only exception is division, where the result may be a float as required.
If you need to manually convert between different numeric types, or round floating values, see the section Type Casts.
Operator |
Returns |
+ |
The sum of the two values. Added in v1.1. |
- |
The second value subtracted from the first. Added in v1.1. |
* |
The multiplication of the values. Added in v1.1. |
/ |
The first value divided by the second. Division by zero yields the @undefined value. Added in v1.1. |
% |
The first value modulo the second. Added in v1.1. |
^ |
The first value raised to the power of the second value (exponentiation). Added in v3.1. |
One string operator is available. It always converts its operands to text:
& |
The second value appended to the first. Added in v1.1. |
Previous Chapter Comments |
<< index >> |
Next Chapter Comparison Operators |