+ Operator

Computes the sum of two numbers or permits expression of a positive number.

Syntax

Binary form
expression1 + expression2
Unary form
+ expression1

Parts

expression1
Required in the binary form; a numeric or string expression
Required in the unary form; a numeric expression
expression2
Required in the binary form; an expression of a type compatible with expression1

Remarks

The binary + operator adds the values of two numeric expressions and returns their numeric sum.

If both expressions are of type string, the result is a new string formed by the concatenation of expression1 and expression2, in that order. It is functionally equivalent to the & operator, but has slightly higher precedence.

The unary + operator passes the numeric value of expression1 unchanged. Thus, it is often referred to as the identity function in mathematics.

Examples

See also