aboutsummaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authorDave Gauer <[email protected]>2021-02-28 11:00:20 -0500
committerDave Gauer <[email protected]>2021-02-28 11:00:20 -0500
commit077a779f3d2fdfc03b2108c518cde2e6d4133ead (patch)
tree29c575a2a9e35aa2ad6535b2fd734ffa213989de /exercises
parent42e6ebd2fe6abd0e46b95baae332c869a2148205 (diff)
downloadziglings-077a779f3d2fdfc03b2108c518cde2e6d4133ead.tar.xz
ziglings-077a779f3d2fdfc03b2108c518cde2e6d4133ead.zip
Change default elephant tail to null (#25)
It was confusing to see tail... = undefined in the struct definition and then if (tail == null) later in the exercise - it appears that the mismatch would be the issue - but that's distracting from the real issue: making the value optional! Changing the initial value to null is still correct, but won't distract. The only worry now is that the user will remember the undefined definition from the previous exercise and wonder if that has to be that way...but you can't win them all!
Diffstat (limited to 'exercises')
-rw-r--r--exercises/46_optionals2.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/exercises/46_optionals2.zig b/exercises/46_optionals2.zig
index 11f37aa..ffa5867 100644
--- a/exercises/46_optionals2.zig
+++ b/exercises/46_optionals2.zig
@@ -9,7 +9,7 @@ const std = @import("std"); // single quotes
const Elephant = struct {
letter: u8,
- tail: *Elephant = undefined, // <---- make this optional!
+ tail: *Elephant = null, // <---- make this optional!
visited: bool = false,
};