Skip to content

format

typescript
Stack.get(index)

class: Stack

description

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

parameter

param_nametypedescription
indexnumberThe index value.

reture

typedescription
T|undefinedThe value of the element.

code example

typescript
let stack = new Stack<Number>();
stack.Push(1);
stack.Push(2);
stack.Push(3);
// Get the value of an element based on the index value
let value = stack.get(0);
Debug.Log("The value of element at index 0 is: ", value);