Return item from a queue

dequeue list

A list in POOL can be used to implement a queue, the "first in, first out" (FIFO) buffer. Instruction dequeue removes and returns an item from a queue (which is the first item in a list).
Items are added to a queue with the instruction queue.

Example:

make "q []
for [i 1 3] [queue :q :i print :q]
print "|***|
while not empty? :q [(print dequeue :q :q)]

Output:

[1]
[1 2]
[1 2 3]
***
1 [2 3]
2 [3]
3 []

See also:

List
queue - add item to a queue

Table of Content