8.8.1 + operator (addition) (find the sum of two expressions)
- Purpose
-
Finds the sum of two expressions.
- Syntax
Result = Expression1 + Expression2
- Arguments
-
- Result
-
Specify a variable for storing the sum of the two expressions.
- Expression1
-
Write any expression.
- Expression2
-
Write any expression.
- Description
-
The + operator adds Expression1 and Expression2 and returns the sum.
The action of the + operator depends on the internal processing of the two expressions, as follows.
Condition
Operation performed
Both expressions are strings.
String concatenation
Both expressions are numbers.
Addition
Both expressions are strings consisting entirely of numbers.
Addition
One expression is a number, and the other is a string.
String concatenation
One expression is a string, and the other is a string consisting entirely of numbers.
String concatenation
One expression is a number, and the other is a string consisting entirely of numbers.
Addition
If both expressions are Empty values, the number 0 is set in Result. However, if only one of the expressions is an Empty value, the other expression is returned as is in Result.
- Note
-
When Result and Expression1 are the same variable, you can use the += operator instead.
- Examples
' This codes stores "ABCDEF" in variable result1. result1 = "ABC" + "DEF" ' This codes stores 12 in variable result2. result2 = 7 + 5 ' This codes stores "10 min." in variable result3. result3 = 10 + "min."
- JP1/Script version
-
Supported from JP1/Script 01-00.