Vikari supports the following binary arithmetic operators:
Operator Name | Symbol | Function |
---|---|---|
Add | + | Add two numbers. |
Subtract | - | Subtract the second number from the first. |
Multiply | * | Multiply two numbers. |
Left Divide | \ | Divide the left number by the right. |
Right Divide | / | Divide the right number by the left. |
These enable expressions to apply the standard arithmetic operations against any of the numeric datatypes. Number types are automatically promoted to the largest necessary type. So if a Float and an Integer are added (i.e. 5 + 2.7) the result will be 7.7 as a Float value.
The following demonstrates use of the arithmetic operators.