From 8af3372cf204861f8541f91e47543f1b33337c5b Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Mon, 4 May 2026 17:15:30 +0200 Subject: fixed removed array multiplication --- exercises/058_quiz7.zig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'exercises/058_quiz7.zig') diff --git a/exercises/058_quiz7.zig b/exercises/058_quiz7.zig index fda83fc..d3b677b 100644 --- a/exercises/058_quiz7.zig +++ b/exercises/058_quiz7.zig @@ -224,11 +224,10 @@ const NotebookEntry = struct { // +---+----------------+----------------+----------+ // const HermitsNotebook = struct { - // Remember the array repetition operator `**`? It is no mere - // novelty, it's also a great way to assign multiple items in an - // array without having to list them one by one. Here we use it to - // initialize an array with null values. - entries: [place_count]?NotebookEntry = .{null} ** place_count, + // Remember the array repetition function @splat()? It is a great way + // to assign multiple items in an array without having to list them + // one by one. Here we use it to initialize an array with null values. + entries: [place_count]?NotebookEntry = @splat(null), // The next entry keeps track of where we are in our "todo" list. next_entry: u8 = 0, @@ -409,7 +408,7 @@ pub fn main() void { // aside memory for the trip and have the hermit's notebook fill // in the trip from the destination back to the path. Note that // this is the first time we've actually used the destination! - var trip = [_]?TripItem{null} ** (place_count * 2); + var trip: [place_count * 2]?TripItem = @splat(null); notebook.getTripTo(trip[0..], destination) catch |err| { print("Oh no! {}\n", .{err}); -- cgit v1.2.3