IStack.Peek

Syntax

Peek: Variant;

Description

The Peek method gets value of the element placed to the stack as the last one.

Comments

After extracting, the element is not removed from a stack.

Example

Sub UserProc;
Var
    Stack1: IStack;
    i: Integer;
    v: Variant;
Begin
    Stack1 := New Stack.Create;
    For i := 0 To Math.RandBetweenI(50100Do
        Stack1.Push("Value " + Math.RandBetweenI(0100).ToString);
    End For;
    v := Stack1.Peek;
End Sub UserProc;

After executing the example a stack of random elements is created, and the "v" variable contains value of the element that was placed to the stack as the last one.

See also:

IStack