These functions allow you to extract one or more items from an array.

## ARRAY_INDEX

Definition: **ARRAY_INDEX(**Array** $list, **Number** $index)**

Get the element at index $i. Indexes range from 1 (the first element) to **ARRAY_LENGTH**($list).

### Examples

Index | Result |
---|---|

ARRAY_INDEX($list, 1) |
Z |

ARRAY_INDEX($list, 2) |
Y |

ARRAY_INDEX($list, 3) |
X |

ARRAY_INDEX($list, 4) |
W |

## ARRAY_FIRST

Definition: **ARRAY_FIRST(**Array** $list)**

Equivalent to **ARRAY_INDEX**($list, 1)

In this example:

**ARRAY_FIRST**($list) will evaluate to the string “Z”.

## ARRAY_LAST

Definition: **ARRAY_LAST(**Array** $list)**

Equivalent to **ARRAY_INDEX**($list, ARRAY_LENGTH($list) – 1)

In this example:

**ARRAY_LAST**($list) will result in the string “W”.

## ARRAY_TAKE

Definition: **ARRAY_TAKE(**Array** $list, **Number** $numberOfItems)**

This function will extract the first $numberOfItems elements from the given array, and put them into a new (shorter) array.

For this example:

Index | Result |
---|---|

ARRAY_TAKE($list, 1) |
[“Z”] |

ARRAY_TAKE ($list, 2) |
[“Z”, “Y”] |

ARRAY_TAKE ($list, 3) |
[“Z”, “Y”, “X”] |

ARRAY_TAKE ($list, 4) |
[“Z”, “Y”, “X”, “W”] |

## ARRAY_SKIP

Definition: **ARRAY_SKIP(Array $list, Number $numberOfItems)**

This function will skip **$numberOfItems** elements from the given array, and keep the rest. The remaining element will be put into a new (shorter) array.

For this example:

Index | Result |
---|---|

ARRAY_SKIP($list, 1) |
[“Y”, “X”, “W”] |

ARRAY_SKIP($list, 2) |
[“X”, “W”] |

ARRAY_SKIP($list, 3) |
[“W”] |

ARRAY_SKIP($list, 4) |
[] |

## ARRAY_SLICE

**ARRAY_SKIP(Array $list, Number $startAt, Number $numberOfItems)**

This function combines **ARRAY_SKIP** and **ARRAY_TAKE** into a single function. The function will:

- Start at
**$startAt (1-based)** - Keep the next
**$numberOfItemsToKeep** - Put these remaining elements into a new (shorter) array and return them

For this example:

Index | Result |
---|---|

ARRAY_SLICE($list, 1, 2) |
[“Z”, “Y”] |

ARRAY_SLICE ($list, 2, 2) |
[“Y”, “X”] |

ARRAY_SLICE ($list, 3, 1) |
[“X”] |