Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.8.2 += operator (addition) (assign to a variable the sum of a variable and an expression)

Purpose

Adds an expression to a variable, and assigns the result to the variable.

Syntax
Result += Expression
Arguments
Result

Specify a variable for storing the addition result.

Expression

Write any expression.

Description

The += operator adds the value of an expression to the value of a variable, and assigns the sum to the variable.

The action of the += operator depends on the same conditions as the + operator, 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. If Result is an Empty value or undefined, the value of Expression is assigned to Result. If Expression is an Empty value, Result remains unchanged.

Examples
' This code stores "ABCDEF" in variable result1.
result1 = "ABC"
result1 += "DEF"
 
' This code stores 11 in variable result2.
result2 = 10
result2 += 1
 
' This code stores 1 in variable result3.
Dim result3
result3 += 1
JP1/Script version

Supported from JP1/Script 06-51.