mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-12 01:49:59 +00:00
changed the patch files that we can also use them with busybox for testing in Woodpecker
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
85c85
|
||||
< const fields = ???;
|
||||
---
|
||||
> const fields = @typeInfo(@TypeOf(tuple)).Struct.fields;
|
||||
92c92
|
||||
< for (fields) |field| {
|
||||
---
|
||||
> inline for (fields) |field| {
|
||||
120,122c120,122
|
||||
< field.???,
|
||||
< field.???,
|
||||
< ???,
|
||||
---
|
||||
> field.name,
|
||||
> field.type,
|
||||
> @field(tuple, field.name),
|
||||
--- exercises/082_anonymous_structs3.zig 2023-10-03 22:15:22.125574535 +0200
|
||||
+++ answers/082_anonymous_structs3.zig 2023-10-05 20:04:07.212769813 +0200
|
||||
@@ -82,14 +82,14 @@
|
||||
// @typeInfo(Circle).Struct.fields
|
||||
//
|
||||
// This will be an array of StructFields.
|
||||
- const fields = ???;
|
||||
+ const fields = @typeInfo(@TypeOf(tuple)).Struct.fields;
|
||||
|
||||
// 2. Loop through each field. This must be done at compile
|
||||
// time.
|
||||
//
|
||||
// Hint: remember 'inline' loops?
|
||||
//
|
||||
- for (fields) |field| {
|
||||
+ inline for (fields) |field| {
|
||||
// 3. Print the field's name, type, and value.
|
||||
//
|
||||
// Each 'field' in this loop is one of these:
|
||||
@@ -117,9 +117,9 @@
|
||||
//
|
||||
// The first field should print as: "0"(bool):true
|
||||
print("\"{s}\"({any}):{any} ", .{
|
||||
- field.???,
|
||||
- field.???,
|
||||
- ???,
|
||||
+ field.name,
|
||||
+ field.type,
|
||||
+ @field(tuple, field.name),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user