mirror of
https://git.aramjonghu.dev/AramJonghu/ziglings.git
synced 2026-09-05 17:53:30 +02:00
two exercises
This commit is contained in:
@@ -31,10 +31,14 @@ pub fn main() void {
|
|||||||
},
|
},
|
||||||
2 => {
|
2 => {
|
||||||
current_value -= 1;
|
current_value -= 1;
|
||||||
|
},
|
||||||
|
else => {
|
||||||
|
unreachable;
|
||||||
},
|
},
|
||||||
3 => {
|
3 => {
|
||||||
current_value *= current_value;
|
current_value *= current_value;
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std.debug.print("{} ", .{current_value});
|
std.debug.print("{} ", .{current_value});
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ pub fn main() void {
|
|||||||
} else |err| switch (err) {
|
} else |err| switch (err) {
|
||||||
MyNumberError.TooBig => std.debug.print(">4. ", .{}),
|
MyNumberError.TooBig => std.debug.print(">4. ", .{}),
|
||||||
// Please add a match for TooSmall here and have it print: "<4. "
|
// Please add a match for TooSmall here and have it print: "<4. "
|
||||||
|
MyNumberError.TooSmall => std.debug.print("<4. ", .{}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user