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_name | type | description |
|---|---|---|
| index | number | The index value. |
reture
| type | description |
|---|---|
T|undefined | The 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);