Arithmetic Operators

The following table lists the operators that can be used in a method to perform mathematical calculations:
PBL Style Java Style Visual Basic Style Description
+ + + Addition
- - - Subtraction
* * * Multiplication
/ / / Division
rem % Mod Modulo (Remainder)

Order of Precedence

When multiple operators are used within an expression, the following order of precedence is followed:
  • operators within parentheses are evaluated first
  • multiplication, division, and modulo are evaluated from left to right
  • addition and subtraction are evaluated from left to right

Using Variables with Arithmetic Operators

Variables of Int, Decimal, Real, Time, and Interval types may be used as operands of arithmetic operators. The result of a given expression is based on the following rules: