The Array operation performs operations on the array variables.
arraySet(TARGET_ARR, EXPRESSION, 1);
1 2
5 3
All elements
arraySetAllItems(TARGET_ARR, EXPRESSION);
1/4 2
5
1: Operation
2: Destination
3: Number of elements
4: All elements
5: Source
[SetTo] | BlockText'arraySetAllItems' |
Writes the variable, constant, or expression specified in the value block to the destination array variable. |
[CopyTo] | BlockText'arrayCopyAllItems'
|
Writes the array variables specified in the variable block to the destination array variable. When [All] is enabled, writes the variable, constant, or expression specified in the source value block to the destination array variable. |
Array operation.
You can create Switch object and configure any trigger type that is associated with
(Example 1)
Consider an array ArrayInt of INT data type with 5 elements.
Condition | Object (Destination) | All Elements | Number of Elements | Parameter (Source) | Result |
BlockText'arraySetAllItems' |
ArrayInt | Enabled | - | 100 | ArrayInt[0]=100 ArrayInt[1]=100 ArrayInt[2]=100 ArrayInt[3]=100 ArrayInt[4]=100 |
ArrayInt[1] | Disabled | 3 | 100 | ArrayInt[1]=100 ArrayInt[2]=100 ArrayInt[3]=100 |
arraySetAllItems(ArrayInt, 100);
arraySet(ArrayInt[1], 100, 3);
(Example 2)
Consider 2 arrays ArrayInt1 and ArrayInt2 of INT data type with 5 elements in each array.
Condition | Object (Destination) | All Elements | Number of Elements | Parameter (Source) | Result |
BlockText'arrayCopyAllItems' |
ArrayInt1 | Enabled | - | ArrayInt2 | ArrayInt1[0]=ArrayInt2[0] ArrayInt1[1]=ArrayInt2[1] ArrayInt1[2]=ArrayInt2[2] ArrayInt1[3]=ArrayInt2[3] ArrayInt1[4]=ArrayInt2[4] |
ArrayInt1[2] | Disabled | 3 | ArrayInt2[0] | ArrayInt1[2]=ArrayInt2[0] ArrayInt1[3]=ArrayInt2[1] ArrayInt1[4]=ArrayInt2[2] |
arrayCopyAllItems(ArrayInt1, ArrayInt2);
arrayCopy(ArrayInt1[2], ArrayInt2[0],3);