18.4.3 Unary minus
The unary minus is a unary operator that returns the negative value of the result of the expression.
- Organization of this subsection
(1) Format
-[(]expression[)]
(2) Description
The operand for the unary minus operator (-) must be arithmetic type. The unary operator is placed before an operand, linking from the right to the left.
Specifying the negative unary operator for a negative value will return a positive value. Specifying the positive unary operator for a negative value will return a negative value.
(3) Example of coding
const integer NG_END = -1; //Statement in the DEFINE section integer sloopcnt, sloopmax, sloopmin; sloopcnt = -(sloopmax - sloopmin); //Statement in the MAIN section