diff options
| author | Chris Boesch <[email protected]> | 2024-05-10 21:40:54 +0000 |
|---|---|---|
| committer | Chris Boesch <[email protected]> | 2024-05-10 21:40:54 +0000 |
| commit | 49c54fb07524cc876742992716874599d56f75f5 (patch) | |
| tree | 09624b9c7400e3535099bc2e1a1f0fec63472883 | |
| parent | dfdaf03d9902058b97713428b628a7a36c9fdf52 (diff) | |
| parent | 67f87a76c23d6205370b0620f82d5847f8a76688 (diff) | |
| download | ziglings-49c54fb07524cc876742992716874599d56f75f5.tar.xz ziglings-49c54fb07524cc876742992716874599d56f75f5.zip | |
Merge pull request 'Nobody wants the long version of finding out if a variable is set.' (#94) from minor_improvements into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/94
| -rw-r--r-- | exercises/046_optionals2.zig | 4 | ||||
| -rw-r--r-- | patches/patches/046_optionals2.patch | 13 |
2 files changed, 7 insertions, 10 deletions
diff --git a/exercises/046_optionals2.zig b/exercises/046_optionals2.zig index d3f65bb..e745d29 100644 --- a/exercises/046_optionals2.zig +++ b/exercises/046_optionals2.zig @@ -51,8 +51,6 @@ fn visitElephants(first_elephant: *Elephant) void { // We should stop once we encounter a tail that // does NOT point to another element. What can // we put here to make that happen? - if (e.tail == null) ???; - - e = e.tail.?; + e = e.tail ??? } } diff --git a/patches/patches/046_optionals2.patch b/patches/patches/046_optionals2.patch index 66912eb..164c0d6 100644 --- a/patches/patches/046_optionals2.patch +++ b/patches/patches/046_optionals2.patch @@ -1,5 +1,5 @@ ---- exercises/046_optionals2.zig 2023-10-03 22:15:22.122241138 +0200 -+++ answers/046_optionals2.zig 2023-10-05 20:04:07.049433424 +0200 +--- exercises/046_optionals2.zig 2024-05-10 23:11:25.796632478 +0200 ++++ answers/046_optionals2.zig 2024-05-10 23:10:16.115335668 +0200 @@ -21,7 +21,7 @@ const Elephant = struct { @@ -9,12 +9,11 @@ visited: bool = false, }; -@@ -51,7 +51,7 @@ +@@ -51,6 +51,6 @@ // We should stop once we encounter a tail that // does NOT point to another element. What can // we put here to make that happen? -- if (e.tail == null) ???; -+ if (e.tail == null) break; - - e = e.tail.?; +- e = e.tail ??? ++ e = e.tail orelse break; } + } |
