Slice constructor
Slice(
- dynamic array,
- dynamic n, [
- dynamic position
Creates $slice
operator expression
-
array
- Any valid expression as long as it resolves to an array. -
position
- Optional. Any valid expression as long as it resolves to an integer.- If positive,
$slice
determines the starting position from the start of the array. Ifposition
is greater than the number of elements, the$slice
returns an empty array. *If negative,$slice
determines the starting position from the end of the array. If the absolute value of theposition
is greater than the number of elements, the starting position is the start of the array.
- If positive,
-
n
- Any valid expression as long as it resolves to an integer. Ifposition
is specified,n
must resolve to a positive integer.- If positive, $slice returns up to the first n elements in the array. If
the
position
is specified,$slice
returns the first n elements starting from the position. - If negative,
$slice
returns up to the lastn
elements in the array.n
cannot resolve to a negative number ifposition
is specified
- If positive, $slice returns up to the first n elements in the array. If
the
Implementation
Slice(array, n, [position])
: super('slice',
AEList([array is List ? AEList(array) : array, position, n]));