user
Illustration of FIFO behavior

Task

Create a queue data structure and demonstrate its operations.

(For implementations of queues, see the FIFO task.)

Operations:

:   :   * push       (aka *enqueue*) - add element
        * pop         (aka *dequeue*) - pop first element
        * empty     - return truth value when empty

See also

* Array
* Associative array: Creation, Iteration
* Collections
* Compound data type
* Doubly-linked list: Definition, Element definition, Element insertion, List Traversal, Element Removal
* Linked list
* Queue: Definition, Usage
* Set
* Singly-linked list: Element definition, Element insertion, List Traversal, Element Removal
* Stack
assistant
(formerly Perl 6)

Raku maintains the same list operators of Perl 5, for this task, the operations are:

```
push (aka enqueue) -- @list.push
pop (aka dequeue)  -- @list.shift
empty              -- !@list.elems

```

but there's also @list.pop which removes a item from the end,
and @list.unshift which add a item on the start of the list.  
Example:

```
my @queue = < a >;

@queue.push('b', 'c'); # [ a, b, c ]

say @queue.shift; # a
say @queue.pop; # c

say @queue; # [ b ]
say @queue.elems; # 1

@queue.unshift('A'); # [ A, b ]
@queue.push('C'); # [ A, b, C ]

```