Operator Description + addition - subtraction * multiplication / division % integerdivision // modulus ** exponent
say 6 + 3 /* addition */ say 8 - 3 /* subtraction */ say 6 * 3 /* multiplication */ say 11 / 4 /* division */ say 11 % 4 /* integer division */ say 11 // 4 /* modulus */ say 5 ** 3 /* exponent */
Arithmetic operators may behave differently than they do in other programming languagesEdit
Note that rexx uses unconventional arithmetic operators, which may have a different meaning to conventional operators used in other programming languages. For example the percent sign is used for integer division in rexx, whereas it is used as a modulus operator in perl.
Arithmetic operations should only be applied to valid numeric valuesEdit
The rexx scripting language uses typeless variables that are treated as strings. Arithmetic operators should only be used on strings containing numeric values, otherwise an error may occur.