diff options
| author | SAJJA EASWAR <eshwarsajja20@gmail.com> | 2026-01-25 22:59:36 +0530 |
|---|---|---|
| committer | SAJJA EASWAR <eshwarsajja20@gmail.com> | 2026-01-25 22:59:36 +0530 |
| commit | ebc8b94baa6bc694cb4829e2eb2934a1f17fa6a1 (patch) | |
| tree | 71b952ad455bf17d5bdea01472f0e2297f25eabe /examples/data_structures/stack.zc | |
| parent | 863118c95caac0d69a35f6ae4d2e83844734a8a1 (diff) | |
| parent | 489336b2101bf16edeec7bfc4379408eb19b936e (diff) | |
Merge branch 'main' into pr-109
Diffstat (limited to 'examples/data_structures/stack.zc')
| -rw-r--r-- | examples/data_structures/stack.zc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/data_structures/stack.zc b/examples/data_structures/stack.zc index 8f1fea5..4a8593a 100644 --- a/examples/data_structures/stack.zc +++ b/examples/data_structures/stack.zc @@ -43,7 +43,7 @@ impl Stack<T> { fn main() { "[Integer Stack]"; - var int_stack = Stack<int>::new(); + let int_stack = Stack<int>::new(); defer int_stack.free(); "Pushing: 10, 20, 30"; @@ -52,19 +52,19 @@ fn main() { int_stack.push(30); "Size: {int_stack.size()}"; - var p = int_stack.peek(); + let p = int_stack.peek(); "Peek: {p.unwrap()}"; "Popping: "..; while !int_stack.is_empty() { - var opt = int_stack.pop(); + let opt = int_stack.pop(); "{opt.unwrap()} "..; } ""; ""; "[String Stack]"; - var str_stack = Stack<String>::new(); + let str_stack = Stack<String>::new(); defer str_stack.free(); str_stack.push(String::new("First")); @@ -73,8 +73,8 @@ fn main() { "Popping: "..; while !str_stack.is_empty() { - var opt_s = str_stack.pop(); - var s: String = opt_s.unwrap(); + let opt_s = str_stack.pop(); + let s: String = opt_s.unwrap(); "{s.c_str()} "..; } ""; |
