Enqueue(Value: Variant);
Value - value that should be placed in a queue.
The Enqueue method places the element, which value is passed by the Value parameter, into a queue. Value is placed to the end of a queue.
Sub Main;
Var
Que: IQueue;
i: Integer;
Begin
Que:=New Queue.Create;
For i:=0 To Math.RandBetweenI(50,100) Do
Que.Enqueue("Value "+Math.RandBetweenI(0,100).ToString);
End For;
For i:=0 To Math.RandBetweenI(0,50) Do
Que.Dequeue;
End For;
i:=Que.Count;
End Sub Main;
After executing the example a queue of random elements is created, part of elements is extracted, and the "i" variable contains the number of elements left in the queue.
See also: