array.last() - Pine Script Function
array.last()
Section titled “array.last()”Overview
Section titled “Overview”Returns the array’s last element. Throws a runtime error if the array is empty.
Syntax
Section titled “Syntax”array.last(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.last example")arr = array.new_int(3, 10)plot(array.last(arr))