aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/exercises/33_iferror.zig
diff options
context:
space:
mode:
authorDave Gauer <ratfactor@gmail.com>2021-02-15 19:32:00 -0500
committerGitHub <noreply@github.com>2021-02-15 19:32:00 -0500
commita2b6b68a255c2d050e4f53a5082c38ec810c1b24 (patch)
tree45f2eba30d72f43df60cd9b053ebaea5dfe11f18 /exercises/33_iferror.zig
parent882a6b6198148673ec97c6e38443f8e2a6a6b576 (diff)
parentbbe93b1f12ae60258a6322e8ec2212fd072b777a (diff)
Merge pull request #22 from quexxon/apply-zig-fmt
Apply `zig fmt` to exercises and generate remaining patch files
Diffstat (limited to 'exercises/33_iferror.zig')
-rw-r--r--exercises/33_iferror.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/exercises/33_iferror.zig b/exercises/33_iferror.zig
index ed92e94..67777a9 100644
--- a/exercises/33_iferror.zig
+++ b/exercises/33_iferror.zig
@@ -23,7 +23,7 @@ const MyNumberError = error{
const std = @import("std");
pub fn main() void {
- var nums = [_]u8{2,3,4,5,6};
+ var nums = [_]u8{ 2, 3, 4, 5, 6 };
for (nums) |num| {
std.debug.print("{}", .{num});
@@ -32,7 +32,7 @@ pub fn main() void {
if (n) |value| {
std.debug.print("=4. ", .{});
} 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. "
}
}
@@ -43,7 +43,7 @@ pub fn main() void {
// This time we'll have numberMaybeFail() return an error union rather
// than a straight error.
fn numberMaybeFail(n: u8) MyNumberError!u8 {
- if(n > 4) return MyNumberError.TooBig;
- if(n < 4) return MyNumberError.TooSmall;
+ if (n > 4) return MyNumberError.TooBig;
+ if (n < 4) return MyNumberError.TooSmall;
return n;
}