Arithmetic ADDITION Operator

The + operator is a special context sensitive binary (infix) operator that behaves as the integer ADDITION operator when its left hand operator is an integer and as the string CONCATINATION operator when its left hand operand is a string.

The + operator expects the types of both its left and right hand operands to match. If they do not, the right hand operand is coerced to match the type of the left hand operand.

If the left hand operand is an integer and the right hand operand is a string, then the right hand operand is automatically coerced to an integer before the integer ADDITION operator is applied.

If the left hand operand is a string and the right hand operand is an integer, then the right hand operand is automatically coerced to a string before the string CONCATINATION operator is applied.

 

syntax:

	<left_expr> + <right_expr>

<left_expr> and <right_expr> are refered to as the left and right operand respectively and may themselves be simple values or complex expressions.

e.g.
	0x1234 + 16			yields 0x1244

	10 + 3				yields 13

	(5 * 7) + 8			yields 280


	"0x1234" + 16			yields "0x123416"

	"(5 * 7)" + 8			yields "(5 * 7)8"

	see string CONCATINATION

	----------------------

	converting a string to an integer

	0 + "0xFF"			yields 255