@@ 30,7 30,7 @@ fn rpn(cmd: []const u8, vals: *Stack) !?
const b = vals.pop().?;
const a = vals.pop().?;
- var result = switch (cmd[0]) {
+ const result = switch (cmd[0]) {
'+' => add(a, b),
'-' => sub(a, b),
'*' => mul(a, b),
@@ 21,14 21,14 @@ pub const Stack = struct {
}
pub fn pop(self: *Self) ?f64 {
- var popped: *Node = self.head orelse return null;
+ const popped: *Node = self.head orelse return null;
defer self.allocator.destroy(popped);
self.head = popped.next;
return popped.data;
}
pub fn peek(self: *Self) ?f64 {
- var next: *Node = self.head orelse return null;
+ const next: *Node = self.head orelse return null;
return next.data;
}