DoxigAlpha

popFirst

Remove and return the first node in the list.

Function parameters

Parameters

#
list:*SinglyLinkedList

This struct contains only a next pointer and not any data payload.

Types

#
Node
This struct contains only a next pointer and not any data payload.

Functions in this namespace

Functions

#
popFirst
Remove and return the first node in the list.
len
Iterate over all nodes, returning the count.

Source

Implementation

#
pub fn popFirst(list: *SinglyLinkedList) ?*Node {
    const first = list.first orelse return null;
    list.first = first.next;
    return first;
}