pop

Summary

Returns and removes the most recently added element.

Usage

public T+ pop()

Returns

The removed element or undefined if the stack was empty.

Description

Returns and removes the most recently added element to the stack. If the stack is empty, undefined will be returned.

Examples

Basic Usage
1
2
3
4
5
import System;
 
auto stack = new Stack<int>([ 1, 2 ]);
Console.log(stack.pop()); // 2
Console.log(stack.pop()); // 1

Share

HTML | BBCode | Direct Link