summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.zig3
-rw-r--r--exercises/013_while3.zig4
-rw-r--r--exercises/065_builtins2.zig7
-rw-r--r--exercises/068_comptime3.zig2
-rw-r--r--exercises/082_anonymous_structs3.zig4
-rw-r--r--patches/patches/065_builtins2.patch4
-rw-r--r--patches/patches/082_anonymous_structs3.patch8
7 files changed, 19 insertions, 13 deletions
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 => {
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");
diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig
index 3d34757..4514b0b 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".
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!)
//
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.???,
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:
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.???,