|
@@ -19,26 +19,28 @@
|
|
//
|
|
//
|
|
const std = @import("std");
|
|
const std = @import("std");
|
|
|
|
|
|
-pub fn main() void {
|
|
|
|
- const operations = [_]u8{ 1, 1, 1, 3, 2, 2 };
|
|
|
|
-
|
|
|
|
- var current_value: u32 = 0;
|
|
|
|
-
|
|
|
|
- for (operations) |op| {
|
|
|
|
- switch (op) {
|
|
|
|
- 1 => {
|
|
|
|
- current_value += 1;
|
|
|
|
- },
|
|
|
|
- 2 => {
|
|
|
|
- current_value -= 1;
|
|
|
|
- },
|
|
|
|
- 3 => {
|
|
|
|
- current_value *= current_value;
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- std.debug.print("{} ", .{current_value});
|
|
|
|
|
|
+pub fn main() void{
|
|
|
|
+ const operations = [_]u8{ 1, 1, 1, 3, 2, 2 };
|
|
|
|
+
|
|
|
|
+ var current_value: u32 = 0;
|
|
|
|
+
|
|
|
|
+ for(operations) |op|{
|
|
|
|
+ switch(op){
|
|
|
|
+ 1 => {
|
|
|
|
+ current_value += 1;
|
|
|
|
+ },
|
|
|
|
+ 2 => {
|
|
|
|
+ current_value -= 1;
|
|
|
|
+ },
|
|
|
|
+ 3 => {
|
|
|
|
+ current_value *= current_value;
|
|
|
|
+ },
|
|
|
|
+ else => { unreachable; },
|
|
}
|
|
}
|
|
-
|
|
|
|
- std.debug.print("\n", .{});
|
|
|
|
|
|
+
|
|
|
|
+ std.debug.print("{} ", .{current_value});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std.debug.print("\n", .{});
|
|
}
|
|
}
|
|
|
|
+
|