Skip to content

format

typescript
List.get(index)

class: List

description

Get the value of an element based on its index (index starts from 0).

parameter

param_nametypedescription
indexnumberThe index of the element.

reture

typedescription
T|undefinedThe value of the element.

code example

typescript
let list = new List<Number>(Number);
for(let i = 0; i<3; i++){
    list.Add(i);// Add elements to the list
}

for (let index = 0; index < list.count; index++) {
    Debug.Log(list.get(index));// Output the elements in the list
}