Function stack::pop()

← Back to Class stack



Module adtClass stack → pop()

Description

Retrieve and remove the top of the Stack, or return nothing if the Stack is empty

stack::pop()


Parameters

There are no parameters.


Return Value


Usage Example

import adt/stack
 
stack = stack()
 
stack.push(10)
stack.push(12)
stack.push(8)
 
writeln(stack.pop())   ' Output: 8
writeln(stack.pop())   ' Output: 12
writeln(stack.pop())   ' Output: 10
writeln(stack.pop())   ' Output: nothing