8.3.14 & operator (concatenate strings)
- Purpose
-
Performs string concatenation on two expressions.
- Syntax
Result = Expression1 & Expression2
- Arguments
-
- Result
-
Specify a variable for storing the result.
- Expression1
-
Write any expression.
- Expression2
-
Write any expression.
- Description
-
The action of the & operator depends on the internal processing of the two expressions, as follows.
Condition
Operation performed
Both expressions are characters.
String concatenation
Both expressions are numbers.
String concatenation
Both expressions are strings consisting entirely of numbers.
String concatenation
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.
String concatenation
If both expressions are Empty values, a zero-length string ("") 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 75 in variable result2. result2 = 7 & 5
- JP1/Script version
-
Supported from JP1/Script 06-00.