Operator
+
+
Description
Used to sum two numbers or concatenate two String values.
Usage
The + operator has two syntaxes:
result = expression1 + expression2
Part |
Type |
Description |
---|---|---|
result |
Number |
The sum of expression1 and expression2. |
expression1 |
Number |
Any numeric expression. |
expression2 |
Number |
Any numeric expression. |
result=expression1 + expression2
Part |
Type |
Description |
---|---|---|
result |
The concatenation of expression1 and expression2. |
|
expression1 |
Any string expression. |
|
expression2 |
Any string expression. |
Notes
You can use Operator Add to define the + operator for custom classes.
Sample code
This example adds several numbers together:
Var sum As Integer
sum = 1 + 2 + 3
This example concatenates two strings and stores the result in a variable:
Var name As String
name = "Bob " + "Roberts" ' name = Bob Roberts
Compatibility
All project types on all supported operating systems.
See also
Operator Add, Str, Val functions; Operator precedence