diff options
author | Dave Gauer <ratfactor@gmail.com> | 2021-02-15 19:32:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-15 19:32:00 -0500 |
commit | 09fd739efa9cee151c8300f53c422d8a72766d49 (patch) | |
tree | 45f2eba30d72f43df60cd9b053ebaea5dfe11f18 /exercises/33_iferror.zig | |
parent | 0d212ecf5a9de1c0bb673a2b6a409de5a99a9d7b (diff) | |
parent | 304489ca1f465b5456fa8c21dd0ae4e4c6c48617 (diff) | |
download | ziglings-09fd739efa9cee151c8300f53c422d8a72766d49.tar.gz ziglings-09fd739efa9cee151c8300f53c422d8a72766d49.tar.bz2 ziglings-09fd739efa9cee151c8300f53c422d8a72766d49.tar.xz ziglings-09fd739efa9cee151c8300f53c422d8a72766d49.zip |
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.zig | 8 |
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; } |