Push(Value: Variant);
Value. Value that should be placed to the stack.
The Push method places the specified value to beginning of the stack.
Sub UserProc;
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 UserProc;
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: