summaryrefslogtreecommitdiff
path: root/examples/data_structures/stack.zc
diff options
context:
space:
mode:
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()} "..;
}
"";