+= Addition assignment operator
- Last Updated: January 18, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Adds a value to an ABL data element. Provides a shorter syntax for applying concatenation, numeric addition, and date-based addition.
Syntax
|
field += expression is equivalent
to field = field + (expression).
field+=expression.ASSIGN, BUFFER-COPY,
SET, and UPDATE statements.- field
- The name of an ABL data element to which you want to add the value of
expression, and that is defined with a data type that
is compatible with the data type of expression. Valid
data types are INTEGER, INT64, DECIMAL, CHARACTER, LONGCHAR, DATE, DATETIME,
and DATETIME-TZ. The data element can include:
- A database or temp-table field
- A variable scoped to the current procedure, user-defined function, or method of a class, or an accessible class-based variable data member, including a subscripted array variable
- A parameter defined for the current procedure, user-defined function, or method of a class, including a subscripted array parameter
- A writable class-based or COM property, including a subscripted array property
- A writable handle attribute or system handle attribute
- ABL syntax that specifies the
CURRENT-VALUEstatement,DYNAMIC-CURRENT-VALUEstatement,DYNAMIC-PROPERTYstatement,ENTRYstatement,EXTENTstatement,LENGTHstatement,PROPATHstatement, orSUBSTRINGstatement
- expression
- An expression with a data type that is consistent with the data type of field.
- NO-ERROR
- The NO-ERROR option is used to prevent the statement from raising
ERRORand displaying error messages. With theNO-ERRORoption, ifERRORis raised, then the ABL element on the left-hand side of the assignment is unchanged.
Examples
The following example shows how to do string concatenation using the += assignment operator. Note that the data types (CHAR
and LONGCHAR) are compatible.
|
The following example shows how to do integer addition using the += assignment operator.
|
The following example uses the +=
assignment operator on variables with mixed numeric data types.
|
The following example uses the +=
assignment operator to add 7 days to a DATE variable.
|
The following example uses the +=
assignment operator to update a database field.
|
The following example uses the +=
assignment operator to update a class property:
|
+=
assignment operator, within an ASSIGN statement,
to update the CreditLimit field and the myCtr variable.
|
+= assignment operator to add to
the PROPATH.
|
See also
Assignment (=) statement, ASSIGN statement, + Addition operator, + Concatenation operator, + Date addition operator, + Datetime addition operator