@slice
Extract a section of an array.
Returns: array
Syntax
Section titled “Syntax”@slice(value start end?)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
value |
array |
Input value |
start |
number |
Start index (inclusive) |
[end] |
number |
End index (exclusive) |
Examples
Section titled “Examples”# Slice middle portionset $arr [10 20 30 40 50]set $mid @slice($arr 1 3)
# Slice from offset to endset $arr [10 20 30 40 50]set $tail @slice($arr 2)
# Negative index sliceset $arr [10 20 30 40 50]set $last2 @slice($arr -2)