Queues
A queue object, queue, is a FIFO (first-in-first-out) container type.
-
$queue() -> queue -
Creates a new
queueobject.
Methods
-
:clear() -
Removes all items from the queue.
-
:count() -> i64 -
Returns the number of items in the queue.
-
:dequeue() -> any -
Removes and returns the next item from the queue. Returns an
errif the queue is empty. -
:enqueue(item: any) -
Adds a new item to the queue.
-
:is_empty() -> bool -
Returns
trueif the queue is empty. -
:peek() -> any -
Returns the next item from the queue without removing it. Returns an
errif the queue is empty.