Additive Operators
The operators
+ and
- are called the additive operators. They have the same
precedence and are syntactically left-associative (they group left-to-right).
AdditiveExpression:
MultiplicativeExpression
AdditiveExpression + MultiplicativeExpression
AdditiveExpression - MultiplicativeExpression
If the type of either operand of a
+ operator is
Prompt, then the operation is prompt concatenation. If
either type is
String or if both are
char, then the operation is string concatenation. If the
type of both operands is Document then the operation is a document
concatenation.
Otherwise, the type of each of the operands of the
+ operator must be a primitive numeric type, or a
parse-time error occurs.
In every case, the type of each of the operands of the binary
- operator must be a primitive numeric type, or a
compile-time error occurs.
The following topics describe additive and multiplcative expressions: