Policies & Guidelines

SLICE

Select a range of items from array

Description

Selects the items starting at the given Start index and ending at the given End index.

Note that the element at the given end index is not included.

You can use a negative end index to select from the end of the array.

Function signature

SLICE(array: Array, start: Number, end: Number) => Array

Parameter

Description

Array

Array to slice

Start

Index of the first item

End

Index where the range ends, not including item at this index. Negative index will be calculated from the end of the array.

Examples

Formula

Return value

SLICE(["a", "b", "c", "d"], 1, 3)

["b","c"]

SLICE(["a", "b", "c", "d"], 0, -1)

["a","b","c"]

SLICE(["a", "b", "c", "d"], 2)

["c","d"]