IStack.Pop

Syntax

Pop: Variant;

Description

The Pop method extracts value of the element placed to the stack as the last one. After extracting the element is removed from the stack.

Example

Sub Main;

Var

Stack1: IStack;

i: Integer;

Begin

Stack1:=New Stack.Create;

For i:=0 To Math.RandBetweenI(50,100) Do

Stack1.Push("Value "+Math.RandBetweenI(0,100).ToString);

End For;

For i:=0 To Math.RandBetweenI(0,50) Do

Stack1.Pop;

End For;

i:=Stack1.Count;

End Sub Main;

After executing the example a stack of random elements is created, part of elements is extracted, and the "i" variable contains the number of elements left in the stack.

See also:

IStack