18.4.5 Adding operators
Adding operators perform addition (+) or subtraction (-).
- Organization of this subsection
(1) Format
- Additive expression
expression + expression
- Subtractive expression
expression - expression
(2) Description
The adding operator performs normal arithmetic conversion for integer-type and float-type operands, according to the data type.
-
The adding operator (+) adds two operands. If the two operands are of the string type, the two character strings are combined. If only one of the two operands is the string type, this results in an error.
-
The subtractive operator (-) subtracts the second operand from the first operand. Both of the operands must have numeric values. If one or both of the operands are the string type, this results in an error.
(3) Example of coding
MAIN { ... sloop_cnt = sloop_cnt+1; sloop_cnt = sloop_cnt-1; ... ... }
(4) Notes
The conversion processing provided by adding operators does not handle overflow and underflow. If the result of conversion by an adding operator cannot be represented with the data type of the operand, information may be lost.