+

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Operator

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 String The concatenation of expression1 and expression2.
expression1 String Any string expression.
expression2 String Any string expression.

Notes

You can use Operator_Add to define the + operator for custom classes.

Examples

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

See Also

Operator_Add, Str, Val functions; Operator precedence