IStack.Contains

Syntax

Contains(Value: Variant): Boolean;

Parameters

Value. Value of the element, which presence should be checked.

Description

The Contains method checks if there is an element with the specified value.

Comments

The method returns True if there is an element with the specified value, and False if the element is missing.

Example

Sub UserProc;
Var
    Stack1: IStack;
    i: Integer;
    s: String;
Begin
    Stack1 := New Stack.Create;
    For i := 0 To Math.RandBetweenI(50100Do
        Stack1.Push("Value " + Math.RandBetweenI(0100).ToString);
    End For;
    If Stack1.Contains("Value 25"Then
        s := "Yes";
    Else
        s := "No";
    End If;
End Sub UserProc;

After executing the example a stack of random elements is created. The "s" variable is set to Yes if the stack contains an element with the Value 25 value.

See also:

IStack