Stack {Containers}R Documentation

Constructor for Class Stack

Description

This method instanciates class Stack.

Usage

aStack = Stack()

Author(s)

John Hughes

Examples

aStack = Stack()             # Instanciate a stack.
aStack$push(3)               # Push a few integers onto the stack.
aStack$push(2)
aStack$push(1)
aStack$top()                 # Inspect the top element.
while (! aStack$isEmpty())   # Print the elements, emptying the stack in the process.
    print(aStack$pop())

[Package Containers version 1.2 Index]