+ Operator

Calculates the sum of two numbers or identifies a positive number.

Syntax

Binary construct

expression_1 + expression_2

Unary construct

+ expression_1

Parts

expression_1
In the binary construct, a numeric or string expression.
In the unary construct, a numeric expression.
expression_2
An expression of a type compatible with expression_1

Instructions

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

If the two expressions are of type String, the result is a new string made by the concatenation of expression_1 and expression_2, in that sequence. It operates the same as the operator &, but + has higher precedence.

The unary operator + returns the numeric value of expression_1 without change. Thus, it is frequently known as the identity function in mathematics.

Examples

Var sum As Int32
sum = 5 + 1
sum = 2.0 + 4.0
sum = 2 + 2 + 2

All the above assignment statements give sum the value 6.

See also

Other elements that use this symbol