pub fn append(list: *DoublyLinkedList, new_node: *Node) void list: *DoublyLinkedListnew_node: *Node80
81
82
83
84
85
86
87
88pub fn append(list: *DoublyLinkedList, new_node: *Node) void {
if (list.last) |last| {
// Insert after last.
list.insertAfter(last, new_node);
} else {
// Empty list.
list.prepend(new_node);
}
}
Insert a new node at the end of the list.
Arguments: new_node: Pointer to the new node to insert.