diff options
| author | Ibrahim Muftee <ibrahim@muftee.net> | 2026-06-30 00:30:23 -0500 |
|---|---|---|
| committer | Ibrahim Muftee <ibrahim@muftee.net> | 2026-06-30 00:30:23 -0500 |
| commit | 3a80e12466086b895f42e7befaa4b4428208301e (patch) | |
| tree | 54ed86c75ad342d1a12a4bdd01cbac75e95d5516 /exercises/082_anonymous_structs3.zig | |
| parent | f3c00ec9a5f262396d50be9694a273b665628c42 (diff) | |
Diffstat (limited to 'exercises/082_anonymous_structs3.zig')
| -rw-r--r-- | exercises/082_anonymous_structs3.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/exercises/082_anonymous_structs3.zig b/exercises/082_anonymous_structs3.zig index e99c826..5a971f5 100644 --- a/exercises/082_anonymous_structs3.zig +++ b/exercises/082_anonymous_structs3.zig @@ -82,17 +82,17 @@ fn printTuple(tuple: anytype) void { // @typeInfo(Circle).@"struct".field_types // // This will be an array of field types. - const field_types = ???; + const field_types = @typeInfo(@TypeOf(tuple)).@"struct".field_types; // This will be an array of field names. - const field_names = ???; + const field_names = @typeInfo(@TypeOf(tuple)).@"struct".field_names; // 2. Loop through each field. This must be done at compile // time. // // Hint: remember 'inline' loops? // - for (???, ???) |???, ???| { + inline for (field_types, field_names) |field_type, field_name| { // 3. Print the field's name, type, and value. // // You'll need this builtin: @@ -116,7 +116,7 @@ fn printTuple(tuple: anytype) void { print("\"{s}\"({any}):{any} ", .{ field_name, field_type, - ???, + @field(tuple, field_name), }); } } |
