+=, -=, *=, /= - Calculation Assignments
| /= rhs.
Calculation assignment with the
- addition assignment operator
- subtraction assignment operator
- multiplication assignment operator
- division assignment operator
These assignments have the same function as the following assignments of arithmetic expressions:
lhs = lhs + ( rhs ).
lhs = lhs - ( rhs ).
The content of
has the result of the parenthesized expression
rhsadded to it,
or has the result of the parenthesized expression
rhssubtracted from it,
or is multiplied by the result of the parenthesized expression
or is divided by the result of the parenthesized expression
The following applies to the operands
lhsis a result position and the following can be specified (if numeric):
rhsis a numeric expression position and the following can be specified (if numeric):
#is not currently possible in constructor expressions. Character-like expressions and bit expressions cannot be specified.
Division by the value 0 is undefined and raises a handleable exception. The only situation where division by 0 does not raise an exception is if the dividend is also 0. Here, the result is set to 0.
Alongside data objects, calculation assignments also allow expressions in the operand positions. This
makes them more powerful than the statements
DIVIDE, and also makes these statements obsolete.
No inline declarations are possible for
Calculation assignments can currently only be specified as standalone statements. They cannot be used
in expressions, for example after
NEXTin reduction operator
See also the concatenation assignment operator
n has the value 1.50 after the calculation assignments.
DATA n TYPE p DECIMALS 2. n += 1. n += 1. n += 1. n += 1. n -= 2. n *= 3. n /= 4.