array->sub

Returns part of an array.

Target member

Signature

1array->sub(position::integer, count::integer= ?)

Returns part of an array.

array->sub is called with member syntax on a receiver value. array->sub is useful when moving through groups of values. Prefer collection operations that match the shape of the data rather than converting everything to strings.

Parameters

position
Required value of type integer. Supply position positionally unless the signature shows a keyword form.
count
Optional value of type integer. Supply count positionally unless the signature shows a keyword form.

Examples

Basic call

1array('a','b','c')->sub(2, 2)
The example shows the normal call shape. Adapt variable names, validation, and surrounding error handling to the context.