mirror of
				https://codeberg.org/ziglings/exercises.git
				synced 2025-10-30 18:25:36 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			32 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);
 | |
|  
 | 
