---
title: "slice · RUAL Documentation"
description: "returns a shallow copy of a portion of an array into a new array object selected from start to end"
canonical: https://docs.rual.nl/block-types/array/array_slice
language: en
---

# slice

This block is part of the [`array`](https://docs.rual.nl/block-types/array) group and was last modified in core [`v10.4.28`](https://docs.rual.nl/core-versions/100428).

returns a shallow copy of a portion of an array into a new array object selected from start to end

- array required `array` The array from which a slice will be created.

- begin required `number` The index at which the slice will start.

- end `number` The index at which the slice will end (optional).

- Array `array` The resulting slice of the array.

Returns a copy of the elements from index begin up to but EXCLUDING end; without end it runs to the end of the array. Negative indexes do NOT count from the end as in JS - they clamp to 0 - and bounds beyond the length clamp to the length; begin greater than end yields []. Example: [a,b,c,d] with begin 1, end 3 -> [b,c].

A typical wiring for [slice](https://docs.rual.nl/block-types/array/array_slice): [number](https://docs.rual.nl/block-types/number/number_default) feeds the `begin` pin; [filter types](https://docs.rual.nl/block-types/array/array_filter_types) feeds the `array` pin; the `array` out pin feeds [match with any](https://docs.rual.nl/block-types/query/query_terms_field).

![Studio canvas example for the slice block: typical wiring for slice.](https://docs.rual.nl/canvas-examples/array_slice.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [number](https://docs.rual.nl/block-types/number/number_default): feeds into this block. Generates a valid number from the filled custom value in the blueprint.

- [filter types](https://docs.rual.nl/block-types/array/array_filter_types): feeds into this block. Returns an array of all items matching the selected type.

- [set fields](https://docs.rual.nl/block-types/mutations/mutations_set_bp_field_multiple): this block feeds into it. Generates an array of mutations based on the given filled fields.

- [get fields](https://docs.rual.nl/block-types/object/object_field_getter_multiple): feeds into this block. Gets the selected fields from the given object.

- [match with any](https://docs.rual.nl/block-types/query/query_terms_field): this block feeds into it.

### Version history

Introduced in [`v10.4.28`](https://docs.rual.nl/core-versions/100428).
