array.first() - Pine Script Function
array.first()
Section titled “array.first()”Overview
Section titled “Overview”Returns the array’s first element. Throws a runtime error if the array is empty.
Syntax
Section titled “Syntax”array.first(id) → series <type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any array type | An array object. |
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("array.first example")arr = array.new_int(3, 10)plot(array.first(arr))