Arrays and Models
An array type holds an ordered, zero-indexed sequence of values of a single element type.
It is written by wrapping the element type in [ and ] square brackets:
[int][string][{ a: int, b: string }][[int]]The element type may be any type, including a struct type and another array type.
A value of an array type is a model: it is what a for element iterates.
A property of an array type, and an array literal, both act as models.
Native code can also supply a model implementation for an array property, which the same operations act on.
Literals
Section titled “Literals”An array literal lists its elements between [ and ], separated by commas:
export component Example { in-out property<[int]> list-of-int: [1, 2, 3]; in-out property<[{a: int, b: string}]> list-of-structs: [{ a: 1, b: "hello" }, { a: 2, b: "world" }];}Each element must have the array’s element type.
An empty literal [] is a model with no elements.
Operations
Section titled “Operations”The following operations apply to a value of an array type.
array.lengthreads the number of elements as anint. It is read-only; it cannot be assigned.array[index]reads the element at the zero-basedindex. The index is anint.array[index] = valuewrites the element atindex. The array must be writable in that context.array.push(value)appendsvalueas a new last element.valuemust have the element type.array.remove(index)removes the element atindex.array.insert(index, value)insertsvaluebefore the element atindex, shifting later elements up.valuemust have the element type.array.index-of(value)returns the index of the first element equal tovalueas anint, or-1if no element matches.valuemust have the element type.
length, push, remove, insert, and index-of are members of the array; index is written with the [ ] operator.
Out-of-bounds behavior
Section titled “Out-of-bounds behavior”Access outside the current bounds does not raise an error; each operation defines its own result.
array[index]withindex < 0orindex >= array.lengthreturns the default value of the element type.array[index] = valuewithindex < 0orindex >= array.lengthdoes nothing.array.remove(index)accepts0 <= index < array.length. Any otherindexleaves the array unchanged.array.insert(index, value)accepts0 <= index <= array.length, so inserting atarray.lengthappends. Any otherindexleaves the array unchanged.
export component Example { in-out property<[int]> list-of-int: [1, 2, 3];
out property <int> len: list-of-int.length; // 3 out property <int> first: list-of-int[0]; // 1 out property <int> past-end: list-of-int[5]; // 0, the default int
init => { // Both do nothing; list-of-int still holds [1, 2, 3]. list-of-int.remove(4); list-of-int.insert(4, 10); }}© 2026 SixtyFPS GmbH