summaryrefslogtreecommitdiff
path: root/examples/data_structures/stack.zc
diff options
context:
space:
mode:
authorsuresh <sureshkrishnan.ai@gmail.com>2026-01-25 11:43:23 -0500
committersuresh <sureshkrishnan.ai@gmail.com>2026-01-25 11:43:23 -0500
commit26a0b55ed5bce4ad0ba2af109cfc96da7be2e34c (patch)
tree35ba8d7742b8ac727bfc6c4c73ab8b70f6eedb53 /examples/data_structures/stack.zc
parent0bb69cb67078dfa921b5b8a42275ef31dfbc9a56 (diff)
parent489336b2101bf16edeec7bfc4379408eb19b936e (diff)
Merge branch 'main' into JsonType
# Conflicts: # examples/data/json_config.zc
Diffstat (limited to 'examples/data_structures/stack.zc')
-rw-r--r--examples/data_structures/stack.zc12
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()} "..;
}
"";