Function remove [src]
Prototype
pub fn remove(list: *SinglyLinkedList, node: *Node) void
Parameters
list: *SinglyLinkedList
node: *Node
Source
pub fn remove(list: *SinglyLinkedList, node: *Node) void {
if (list.first == node) {
list.first = node.next;
} else {
var current_elm = list.first.?;
while (current_elm.next != node) {
current_elm = current_elm.next.?;
}
current_elm.next = node.next;
}
}