exercises/patches/patches/106_files.patch
2026-01-09 22:56:23 +01:00

21 lines
797 B
Diff

--- exercises/106_files.zig 2026-01-09 22:41:19.373872684 +0100
+++ answers/106_files.zig 2026-01-09 22:41:44.518372910 +0100
@@ -41,7 +41,7 @@
// by doing nothing
//
// we want to catch error.PathAlreadyExists and do nothing
- ??? => {},
+ error.PathAlreadyExists => {},
// if there's any other unexpected error we just propagate it through
else => return e,
};
@@ -61,7 +61,7 @@
// but here we are not yet done writing to the file
// if only there were a keyword in Zig that
// allowed you to "defer" code execution to the end of the scope...
- file.close(io);
+ defer file.close(io);
// you are not allowed to move these lines above the file closing line!
var file_writer = file.writer(io, &.{});