From 7d1944ab9d2307f2736afe8520436872db1c7617 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sun, 25 Jan 2026 15:12:12 +0000 Subject: 'let' it be --- examples/data_structures/linked_list.zc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'examples/data_structures/linked_list.zc') diff --git a/examples/data_structures/linked_list.zc b/examples/data_structures/linked_list.zc index cb85554..cd16bf5 100644 --- a/examples/data_structures/linked_list.zc +++ b/examples/data_structures/linked_list.zc @@ -8,7 +8,7 @@ struct Node { impl Node { fn new(v: int) -> Self* { - var n = alloc(); + let n = alloc(); guard n != NULL else { "Out of memory!"; return NULL; @@ -29,7 +29,7 @@ impl LinkedList { } fn push(self, v: int) { - var new_node = Node::new(v); + let new_node = Node::new(v); guard new_node != NULL else { return; } new_node.next = self.head; @@ -37,7 +37,7 @@ impl LinkedList { } fn print_list(self) { - var current: Node* = self.head; + let current: Node* = self.head; "["..; while current != NULL { "{current.value}"..; @@ -50,17 +50,17 @@ impl LinkedList { } fn free(self) { - var current: Node* = self.head; + let current: Node* = self.head; while current != NULL { - autofree var temp = current; + autofree let temp = current; current = current.next; } self.head = NULL; } fn len(self) -> int { - var count = 0; - var current: Node* = self.head; + let count = 0; + let current: Node* = self.head; while current != NULL { count++; current = current.next; @@ -70,7 +70,7 @@ impl LinkedList { } fn main() { - var list = LinkedList::new(); + let list = LinkedList::new(); defer list.free(); "Pushing: 10, 20, 30..."; -- cgit v1.2.3