diff options
Diffstat (limited to 'exercises/058_quiz7.zig')
| -rw-r--r-- | exercises/058_quiz7.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/exercises/058_quiz7.zig b/exercises/058_quiz7.zig index d3b677b..f7d231d 100644 --- a/exercises/058_quiz7.zig +++ b/exercises/058_quiz7.zig @@ -192,8 +192,8 @@ const TripItem = union(enum) { // 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}), } } }; @@ -254,7 +254,7 @@ const HermitsNotebook = struct { // 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; @@ -308,7 +308,7 @@ const HermitsNotebook = struct { // // 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); |
