Assignment operators
Provides a reference for the syntax of assignment operators in OPL.
The equals (=) operator can be used to assign a new value to a script variable or a property.
| Syntax | Effect |
|---|---|
| variable = expression | In scripting, all objects are assigned by reference, except strings, numbers and Booleans, which are assigned by value. See the ECMA standard for details. Example: x
= y+1The whole expression returns the value of |
value.name = expression value[name] = expression |
Assigns the value of If
Example: car.name = "Ford" myArray[i] = myArray[i]+1The whole expression returns the value of expression. |
In addition, shorthand operators are also defined.