1
0
Fork 0
mirror of https://codeberg.org/ziglings/exercises.git synced 2025-06-08 10:07:01 +09:00
exercises/patches/patches/058_quiz7.patch
Chris Boesch 8f49400aa1
Fixed patch from quiz7 after text changes
#Please enter the commit message for your changes. Lines starting
2024-10-28 09:40:17 +01:00

31 lines
1.4 KiB
Diff

--- exercises/058_quiz7.zig 2024-10-28 09:06:49.448505460 +0100
+++ answers/058_quiz7.zig 2024-10-28 09:35:14.631932322 +0100
@@ -192,8 +192,8 @@
// Oops! The hermit forgot how to capture the union values
// in a switch statement. Please capture each value as
// 'p' so the print statements work!
- .place => print("{s}", .{p.name}),
- .path => print("--{}->", .{p.dist}),
+ .place => |p| print("{s}", .{p.name}),
+ .path => |p| print("--{}->", .{p.dist}),
}
}
};
@@ -255,7 +255,7 @@
// dereference and optional value "unwrapping" look
// together. Remember that you return the address with the
// "&" operator.
- if (place == entry.*.?.place) return entry;
+ if (place == entry.*.?.place) return &entry.*.?;
// Try to make your answer this long:__________;
}
return null;
@@ -309,7 +309,7 @@
//
// Looks like the hermit forgot something in the return value of
// this function. What could that be?
- fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) void {
+ fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) TripError!void {
// We start at the destination entry.
const destination_entry = self.getEntry(dest);