diff options
| author | Roman Frołow <rofrol@gmail.com> | 2024-11-02 10:48:50 +0100 |
|---|---|---|
| committer | Roman Frołow <rofrol@gmail.com> | 2024-11-02 10:48:50 +0100 |
| commit | f629d78268e8003437807eac34e0aa461e081cdd (patch) | |
| tree | 04dcb7850fae414e26e1133348aaa18501a81456 | |
| parent | 71b4f5ea8130432c162de1f230c95d19f43b24a3 (diff) | |
reuse fields
| -rw-r--r-- | exercises/065_builtins2.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig index 0790db4..db0ea30 100644 --- a/exercises/065_builtins2.zig +++ b/exercises/065_builtins2.zig @@ -110,15 +110,15 @@ pub fn main() void { // name will not be printed if the field is of type 'void' // (which is a zero-bit type that takes up no space at all!): if (fields[0].??? != void) { - print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[0].name}); + print(" {s}", .{fields.name}); } if (fields[1].??? != void) { - print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[1].name}); + print(" {s}", .{fields[1].name}); } if (fields[2].??? != void) { - print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[2].name}); + print(" {s}", .{fields[2].name}); } // Yuck, look at all that repeated code above! I don't know |
