mirror of
https://codeberg.org/ziglings/exercises.git
synced 2024-12-26 01:20:30 +00:00
Add patch.
This commit is contained in:
parent
3763f976eb
commit
f656e950d5
1 changed files with 8 additions and 8 deletions
|
@ -1,18 +1,18 @@
|
||||||
--- exercises/046_optionals2.zig 2024-05-10 23:11:25.796632478 +0200
|
--- exercises/046_optionals2.zig 2024-06-23 19:43:16
|
||||||
+++ answers/046_optionals2.zig 2024-05-10 23:10:16.115335668 +0200
|
+++ answers/046_optionals2.zig 2024-06-23 19:42:46
|
||||||
@@ -21,7 +21,7 @@
|
@@ -22,7 +22,7 @@
|
||||||
|
|
||||||
const Elephant = struct {
|
const Elephant = struct {
|
||||||
letter: u8,
|
letter: u8,
|
||||||
- tail: *Elephant = null, // Hmm... tail needs something...
|
- tail: *Elephant = null, // Hmm... tail needs something...
|
||||||
+ tail: ?*Elephant = null, // <---- make this optional!
|
+ tail: ?*Elephant = null, // Hmm... tail needs something...
|
||||||
visited: bool = false,
|
visited: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,6 +51,6 @@
|
@@ -66,6 +66,6 @@
|
||||||
// We should stop once we encounter a tail that
|
|
||||||
// does NOT point to another element. What can
|
// HINT: We want something similar to what `.?` does,
|
||||||
// we put here to make that happen?
|
// but instead of ending the program, we want to exit the loop...
|
||||||
- e = e.tail ???
|
- e = e.tail ???
|
||||||
+ e = e.tail orelse break;
|
+ e = e.tail orelse break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue