Queue/Usage: Difference between revisions

Line 519:
<lang oberon2>
MODULE UseQueue;
IMPORT StdLog,Queue,Boxes;
Queue,
 
Boxes,
StdLog;
PROCEDURE Do*;
VAR
q: Queue.QueueInstance;
o b: Boxes.ObjectBox;
BEGIN
q := Queue.NewQueueNew(610);
q.Push(Boxes.NewInteger(1));
q.Push(Boxes.NewInteger(2));
q.Push(Boxes.NewInteger(3));
o b := q.Pop();
o b := q.Pop();
q.Push(Boxes.NewInteger(4));
o b := q.Pop();
o b := q.Pop();
StdLog.String("Is empty:> ");StdLog.Bool(q.IsEmpty());StdLog.Ln
q.Push(Boxes.NewInteger(5));
o := q.Pop();
StdLog.String("Is empty: ");StdLog.Bool(q.IsEmpty());StdLog.Ln
END Do;
END UseQueue.
Line 546 ⟶ 547:
Is empty: $TRUE
</pre>
 
=={{header|D}}==
<lang d>class LinkedQueue(T) {
Anonymous user