Add item to a queue

queue list expression

A list in POOL can be used to implement a queue, the "first in, first out" (FIFO) buffer. Instruction queue adds an item at the end of a queue (which is the last item in a list).
Items are returned from a queue with the instruction dequeue.

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
dequeue - return item from a queue

Table of Content