This commit is contained in:
parent
63c6d822d2
commit
09d95042cb
|
@ -82,14 +82,14 @@ fn printTuple(tuple: anytype) void {
|
|||
// @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 @@ fn printTuple(tuple: anytype) void {
|
|||
//
|
||||
// The first field should print as: "0"(bool):true
|
||||
print("\"{s}\"({s}):{any} ", .{
|
||||
field.???,
|
||||
field.???,
|
||||
???,
|
||||
field.name,
|
||||
field.field_type,
|
||||
@field(tuple, field.name),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue