Utilities / Reference
generic-collection
Pine v6 generic type syntax: `array<T>`, `matrix<T>`, `map<T>` work both as type annotations on var/let declarations and as call generics on `.new<T>(...)`. Equivalent to the type-suffixed form (e.g. `array.new<float>()` is the same as `array.new_float()`).
generic-collection array<T> name = array.new<T>(size?, initialValue?) → Array<T> | Matrix<T> | Map<T>Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
T | type | Yes | — | Element type: int, float, string, bool, color. |
Returns
Array<T> | Matrix<T> | Map<T>Example
generic-collection
var array<float> buf = array.new<float>()var array<int> cnt = array.new<int>(9, 0)array.push(buf, close)// Older typed-suffix form (still supported):// var buf2 = array.new_float()Notes
- A method called on a collection variable that holds na answers as its function form does: `a.size()` is 0, `a.indexof(x)` is -1 and `a.includes(x)` is false, exactly like `array.size(a)`, `array.indexof(a, x)` and `array.includes(a, x)`.
Names and aliases
Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.