diff options
author | Will Clardy <will@quexxon.net> | 2021-02-15 16:55:44 -0500 |
---|---|---|
committer | Will Clardy <will@quexxon.net> | 2021-02-15 16:55:44 -0500 |
commit | 2f821bd5e83129445179ea7bd81260df74fff295 (patch) | |
tree | 4f88d7f715dcd0bc98d20f3b7f70d49f2bdcb408 /exercises/21_errors.zig | |
parent | e58f155bd6261a0c1408e8bb3b177bbced828eb3 (diff) | |
download | ziglings-2f821bd5e83129445179ea7bd81260df74fff295.tar.gz ziglings-2f821bd5e83129445179ea7bd81260df74fff295.tar.bz2 ziglings-2f821bd5e83129445179ea7bd81260df74fff295.tar.xz ziglings-2f821bd5e83129445179ea7bd81260df74fff295.zip |
Apply `zig fmt` to exercises
Diffstat (limited to 'exercises/21_errors.zig')
-rw-r--r-- | exercises/21_errors.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/exercises/21_errors.zig b/exercises/21_errors.zig index 7714c4b..cbb5ac8 100644 --- a/exercises/21_errors.zig +++ b/exercises/21_errors.zig @@ -4,7 +4,7 @@ // In Zig, an error is a value. Errors are named so we can identify // things that can go wrong. Errors are created in "error sets", which // are just a collection of named errors. -// +// // We have the start of an error set, but we're missing the condition // "TooSmall". Please add it where needed! const MyNumberError = error{ @@ -16,13 +16,13 @@ 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) |n| { std.debug.print("{}", .{n}); const number_error = numberFail(n); - + if (number_error == MyNumberError.TooBig) { std.debug.print(">4. ", .{}); } @@ -40,7 +40,7 @@ pub fn main() void { // Notice how this function can return any member of the MyNumberError // error set. fn numberFail(n: u8) MyNumberError { - if(n > 4) return MyNumberError.TooBig; - if(n < 4) return MyNumberError.TooSmall; // <---- this one is free! + if (n > 4) return MyNumberError.TooBig; + if (n < 4) return MyNumberError.TooSmall; // <---- this one is free! return MyNumberError.TooFour; } |