# Array

The Array operation performs operations on the array variables.

##### Block

##### Text

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

### Operation

[SetTo] | ##### Block [SetTo] ##### Text 'arraySet' 'arraySetAllItems' | Writes the variable, constant, or expression specified in the value block to the destination array variable.
[CopyTo] | ##### Block [CopyTo] ##### Text 'arrayCopy' '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.

Note: You can create Switch object and configure any trigger type that is associated with Array operation.

(Example 1)

Consider an array ArrayInt of INT data type with 5 elements.

Condition | Object (Destination) | All Elements | Number of Elements | Parameter (Source) | Result
##### Block [SetTo] ##### Text 'arraySet' '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

#### ArrayInt

##### Block

##### Text

arraySetAllItems(ArrayInt, 100);

#### ArrayInt[1]

##### Block

##### Text

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
##### Block [CopyTo] ##### Text 'arrayCopy' '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]

#### ArrayInt1

##### Block

##### Text

arrayCopyAllItems(ArrayInt1, ArrayInt2);

#### ArrayInt1[2]

##### Block

##### Text

arrayCopy(ArrayInt1[2], ArrayInt2[0],3);