Class: Stack

@include <Stack>

Simple Stack implementation

Methods

@Stack.size

Scope: public

Echo the number of elements in the stack.

Outputs: The number of elements in the stack.

Usage: @Stack.size

@Stack.push

Scope: public

Push a value onto the top of the stack.

Usage: @Stack.push $value

Parameters

  • value
    • Type: Primitive
    • The value to push onto the top of the stack.

@Stack.pop

Scope: public

Pop the top element off the stack and echo it.

Returns: 1 if the stack is empty, 0 otherwise.

Outputs: The value at the top of the stack.

Usage: @Stack.pop

@Stack.top

Scope: public

Echo the top element of the stack without removing it.

Returns: 1 if the stack is empty, 0 otherwise.

Outputs: The value at the top of the stack.

Usage: @Stack.top

@Stack.clear

Scope: public

Clear the stack by removing all elements.

Usage: @Stack.clear

@Stack.empty

Scope: public

Silently check whether the stack is empty.

Returns: 0 if the stack is empty, 1 otherwise.

Outputs: nothing

Usage: @Stack.empty