From 8a2e40040b32378cf8a71af1cd5f19d163417f55 Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 03:38:26 +0100 Subject: [PATCH 1/9] replace deprecated `mem.indexOf` with `mem.find` --- exercises/065_builtins2.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig index 2d13994..3d34757 100644 --- a/exercises/065_builtins2.zig +++ b/exercises/065_builtins2.zig @@ -147,9 +147,9 @@ pub fn main() void { // We'll be seeing @typeName again in Exercise 070. For now, you can // see that it takes a Type and returns a u8 "string". fn maximumNarcissism(myType: type) []const u8 { - const indexOf = @import("std").mem.indexOf; + const find = @import("std").mem.find; // Turn "065_builtins2.Narcissus" into "Narcissus" const name = @typeName(myType); - return name[indexOf(u8, name, ".").? + 1 ..]; + return name[find(u8, name, ".").? + 1 ..]; } From 4aeb7b83b9534042e42c27839db40f2a288feabb Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 03:38:59 +0100 Subject: [PATCH 2/9] add commas --- exercises/039_pointers.zig | 2 +- exercises/103_tokenization.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/039_pointers.zig b/exercises/039_pointers.zig index 24ca46d..792fcc7 100644 --- a/exercises/039_pointers.zig +++ b/exercises/039_pointers.zig @@ -4,7 +4,7 @@ // var foo: u8 = 5; // foo is 5 // var bar: *u8 = &foo; // bar is a pointer // -// What is a pointer? It's a reference to a value. In this example +// What is a pointer? It's a reference to a value. In this example, // bar is a reference to the memory space that currently contains the // value 5. // diff --git a/exercises/103_tokenization.zig b/exercises/103_tokenization.zig index 972e8e8..7ac56cb 100644 --- a/exercises/103_tokenization.zig +++ b/exercises/103_tokenization.zig @@ -2,7 +2,7 @@ // The functionality of the standard library is becoming increasingly // important in Zig. First of all, it is helpful to take a look at how // the individual functions are implemented. Because this is wonderfully -// suitable as a template for your own functions. In addition these +// suitable as a template for your own functions. In addition, these // standard functions are part of the basic configuration of Zig. // // This means that they are always available on every system. From 2e981d408fcf88dea67211a911c9c35ea3645d7c Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 03:48:11 +0100 Subject: [PATCH 3/9] add hint that @field() works differently on types and values --- exercises/082_anonymous_structs3.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercises/082_anonymous_structs3.zig b/exercises/082_anonymous_structs3.zig index 469cd66..c13774f 100644 --- a/exercises/082_anonymous_structs3.zig +++ b/exercises/082_anonymous_structs3.zig @@ -118,6 +118,10 @@ fn printTuple(tuple: anytype) void { // @field(foo, "x"); // returns the value at foo.x // // The first field should print as: "0"(bool):true + // + // Hint: Be careful! If your 'lhs' is a type, @field() looks + // for declarations. If it's a value, it looks for data. + // print("\"{s}\"({any}):{any} ", .{ field.???, field.???, From 46cf5e802c2774d46e8fa97c5042066a82bfb606 Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 03:51:12 +0100 Subject: [PATCH 4/9] fix 068_comptime3 comment to 'std.Io.Writer.print' --- exercises/068_comptime3.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/068_comptime3.zig b/exercises/068_comptime3.zig index 15b8997..bb82778 100644 --- a/exercises/068_comptime3.zig +++ b/exercises/068_comptime3.zig @@ -11,7 +11,7 @@ // format string can be checked for errors at compile time rather // than crashing at runtime. // -// (The actual formatting is done by std.fmt.format() and it +// (The actual formatting is done by std.Io.Writer.print() and it // contains a complete format string parser that runs entirely at // compile time!) // From 686342375ed3f6ccd80b8483d37817d5a7bc8d8e Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 03:55:37 +0100 Subject: [PATCH 5/9] improve comment stating 'Zig 0.10.0' @typeName change --- exercises/065_builtins2.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig index 2d13994..0fde989 100644 --- a/exercises/065_builtins2.zig +++ b/exercises/065_builtins2.zig @@ -137,12 +137,13 @@ pub fn main() void { } // NOTE: This exercise did not originally include the function below. -// But a change after Zig 0.10.0 added the source file name to the -// type. "Narcissus" became "065_builtins2.Narcissus". +// After Zig 0.10.0, `@typeName` began prefixing the returned type name +// with the source file name. For example, "Narcissus" became +// "065_builtins2.Narcissus". // // To fix this, we've added this function to strip the filename from // the front of the type name. (It returns a slice of the type name -// starting at the index + 1 of character ".") +// starting just after the ".") // // We'll be seeing @typeName again in Exercise 070. For now, you can // see that it takes a Type and returns a u8 "string". From 93aa733d33afe55fc8c40037c2cb46380e1521c8 Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 04:07:06 +0100 Subject: [PATCH 6/9] improve comment on continue expression behavior --- exercises/013_while3.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/013_while3.zig b/exercises/013_while3.zig index 4cccf62..52d5ebd 100644 --- a/exercises/013_while3.zig +++ b/exercises/013_while3.zig @@ -11,8 +11,8 @@ // // } // -// The "continue expression" executes every time the loop restarts -// whether the "continue" statement happens or not. +// The "continue expression" executes every single time the loop restarts, +// even when a `continue` statement skips the rest of the loop body. // const std = @import("std"); From 178fd9cef35b5356b9eeb75dcf45d72b1136352f Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 04:12:46 +0100 Subject: [PATCH 7/9] fix `zig build` error when '.progress.txt' contains newline --- build.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 0ad2a1e..c3b2a43 100644 --- a/build.zig +++ b/build.zig @@ -278,7 +278,8 @@ pub fn build(b: *Build) !void { return error.UnexpectedEOF; } - starting_exercise = try std.fmt.parseInt(u32, contents, 10); + const trimmed_contents = std.mem.trim(u8, contents, "\r\n"); + starting_exercise = try std.fmt.parseInt(u32, trimmed_contents, 10); } else |err| { switch (err) { std.Io.File.OpenError.FileNotFound => { From 53f7e015cbc3966e70b6436415c1e1421ae7f8cf Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 13:09:54 +0100 Subject: [PATCH 8/9] update patch file --- patches/patches/082_anonymous_structs3.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/patches/082_anonymous_structs3.patch b/patches/patches/082_anonymous_structs3.patch index 0f71a94..28a6728 100644 --- a/patches/patches/082_anonymous_structs3.patch +++ b/patches/patches/082_anonymous_structs3.patch @@ -1,5 +1,5 @@ ---- exercises/082_anonymous_structs3.zig 2025-03-14 16:41:17.892873287 +0200 -+++ answers/082_anonymous_structs3.zig 2025-03-14 16:40:56.043829543 +0200 +--- exercises/082_anonymous_structs3.zig 2026-02-27 13:05:46 ++++ answers/082_anonymous_structs3.zig 2026-02-27 13:07:22 @@ -82,14 +82,14 @@ // @typeInfo(Circle).@"struct".fields // @@ -17,9 +17,9 @@ // 3. Print the field's name, type, and value. // // Each 'field' in this loop is one of these: -@@ -119,9 +119,9 @@ +@@ -123,9 +123,9 @@ + // for declarations. If it's a value, it looks for data. // - // The first field should print as: "0"(bool):true print("\"{s}\"({any}):{any} ", .{ - field.???, - field.???, From 9db32388e3ffe206353f037a7706677e1719b429 Mon Sep 17 00:00:00 2001 From: Paul Ebose Date: Fri, 27 Feb 2026 13:11:03 +0100 Subject: [PATCH 9/9] update patch file --- patches/patches/065_builtins2.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/patches/065_builtins2.patch b/patches/patches/065_builtins2.patch index ad4192b..89fd652 100644 --- a/patches/patches/065_builtins2.patch +++ b/patches/patches/065_builtins2.patch @@ -1,5 +1,5 @@ ---- exercises/065_builtins2.zig 2025-06-17 13:58:07.857258167 +0200 -+++ answers/065_builtins2.zig 2025-06-17 13:56:36.630415938 +0200 +--- exercises/065_builtins2.zig 2026-02-27 13:10:36 ++++ answers/065_builtins2.zig 2026-02-27 13:10:52 @@ -58,7 +58,7 @@ // Oops! We cannot leave the 'me' and 'myself' fields // undefined. Please set them here: