19 lines
587 B
Diff
19 lines
587 B
Diff
--- exercises/046_optionals2.zig 2024-09-04 20:51:36.766783971 +0200
|
|
+++ answers/046_optionals2.zig 2024-09-04 20:51:01.389400985 +0200
|
|
@@ -22,7 +22,7 @@
|
|
|
|
const Elephant = struct {
|
|
letter: u8,
|
|
- tail: *Elephant = null, // Hmm... tail needs something...
|
|
+ tail: ?*Elephant = null, // Hmm... tail needs something...
|
|
visited: bool = false,
|
|
};
|
|
|
|
@@ -66,6 +66,6 @@
|
|
|
|
// HINT: We want something similar to what `.?` does,
|
|
// but instead of ending the program, we want to exit the loop...
|
|
- e = e.tail ???
|
|
+ e = e.tail orelse break;
|
|
}
|
|
}
|