array.shift() - Pine Script Function
array.shift()
Section titled “array.shift()”Overview
Section titled “Overview”The function removes an array’s first element and returns its value.
Syntax
Section titled “Syntax”array.shift(id) → series <type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any array type | An array object. |
Returns
Section titled “Returns”The value of the removed element.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.shift example")a = array.new_float(5,high)removedEl = array.shift(a)plot(array.size(a))plot(removedEl)