Array Assignment Operators
Arithmetic may also be performed on arrays. These operations can be SIMD-accelerated.
-
Add:
+=
-
Subtract:
-=
-
Divide:
/=
-
Integer Divide:
//=
-
Multiply:
*=
-
Exponent:
**=
There are also some array-specific operations:
-
Append ( ++
): Append values to the array
$ let ARRAY = [ 1 2 3 ]
$ let ARRAY ++= 4
$ let ARRAY ++= [5 6 7]
$ echo @ARRAY
1 2 3 4 5 6 7
-
Append-Head ( ::
): Insert values at the beginning of the array
$ let ARRAY = [ 4 5 6 ]
$ let ARRAY ::= [ 1 2 3 ]
$ echo @ARRAY
1 2 3 4 5 6
-
Difference ( \\
): Retain values which are different from the array on the right
$ let ARRAY = [ 1 2 3 4 5 6 ]
$ let ARRAY \\= [1 3 5]
$ echo @ARRAY
2 4 6
Edited by stratact