mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 07:50:00 +00:00
Fix 071_comptime6.zig because of new build system
This commit is contained in:
@@ -36,13 +36,14 @@ pub fn main() void {
|
|||||||
// statement was repeated three times almost verbatim. Yuck!
|
// statement was repeated three times almost verbatim. Yuck!
|
||||||
//
|
//
|
||||||
// Please use an 'inline for' to implement the block below
|
// Please use an 'inline for' to implement the block below
|
||||||
// for each field in the slice 'fields'!
|
// for each field in the corresponding slices (they're of the same length)!
|
||||||
|
|
||||||
const fields = @typeInfo(Narcissus).@"struct".fields;
|
const field_names = @typeInfo(Narcissus).@"struct".field_names;
|
||||||
|
const field_types = @typeInfo(Narcissus).@"struct".field_types;
|
||||||
|
|
||||||
??? {
|
??? {
|
||||||
if (field.type != void) {
|
if (field_type != void) {
|
||||||
print(" {s}", .{field.name});
|
print(" {s}", .{field_name});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
--- exercises/071_comptime6.zig 2024-09-02 19:21:50.250454978 +0200
|
--- exercises/071_comptime6.zig 2026-06-01 15:35:27.223400223 +0200
|
||||||
+++ answers/071_comptime6.zig 2024-09-02 19:21:23.553250563 +0200
|
+++ answers/071_comptime6.zig 2026-06-01 15:36:35.349728561 +0200
|
||||||
@@ -40,7 +40,7 @@
|
@@ -41,7 +41,7 @@
|
||||||
|
const field_names = @typeInfo(Narcissus).@"struct".field_names;
|
||||||
const fields = @typeInfo(Narcissus).@"struct".fields;
|
const field_types = @typeInfo(Narcissus).@"struct".field_types;
|
||||||
|
|
||||||
- ??? {
|
- ??? {
|
||||||
+ inline for (fields) |field| {
|
+ inline for (field_names, field_types) |field_name, field_type| {
|
||||||
if (field.type != void) {
|
if (field_type != void) {
|
||||||
print(" {s}", .{field.name});
|
print(" {s}", .{field_name});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user