Container Insert Operator += in X++ Language
Table of Content:
- The += insert operator is used to insert one or more elements into a container.
- += is faster than the conIns() function, however note that it inserts at the end after last index location. Therefore use this operation when insertion has no relevance to index position especially used in loops.
Example:
Code:
static void Job8(Args _args) { // container declaration and initialization with 2 values container containerName = ["Welcome", 1202]; str charHolder; ; // += is faster than the conIns() function // however note it inserts at the end after last index location // Therefore use this operation when insertion has no relevance to index position containerName += 200; info(strFmt("Container containerName += usage values are :- %1 , %2, %3, %4", conPeek(containerName, 1), conPeek(containerName, 2), conPeek(containerName, 3), conPeek(containerName, 4))); }
Output:
The above code will produce the following result-
Container containerName += usage values are :- Welcome , 1202, 200, 0