mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-07-28 18:25:16 +00:00
935d268280
Rename `fetchTheMostBeautifulType` to `FetchTheMostBeautifulType` to follow Zig's standard naming practice.
44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
--- exercises/065_builtins2.zig 2026-06-01 15:33:16.617432671 +0200
|
|
+++ answers/065_builtins2.zig 2026-06-01 15:33:31.104018108 +0200
|
|
@@ -58,7 +58,7 @@
|
|
// Oops! We cannot leave the 'me' and 'myself' fields
|
|
// undefined. Please set them here:
|
|
narcissus.me = &narcissus;
|
|
- narcissus.??? = ???;
|
|
+ narcissus.myself = &narcissus;
|
|
|
|
// This determines a "peer type" from three separate
|
|
// references (they just happen to all be the same object).
|
|
@@ -70,7 +70,7 @@
|
|
//
|
|
// The fix for this is very subtle, but it makes a big
|
|
// difference!
|
|
- const Type2 = narcissus.FetchTheMostBeautifulType();
|
|
+ const Type2 = Narcissus.FetchTheMostBeautifulType();
|
|
|
|
// Now we print a pithy statement about Narcissus.
|
|
print("A {s} loves all {s}es. ", .{
|
|
@@ -102,16 +102,16 @@
|
|
// Please complete these 'if' statements so that the field
|
|
// 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 (field_???[???] != void) {
|
|
- print(" {s}", .{field_???[???]});
|
|
+ if (field_types[0] != void) {
|
|
+ print(" {s}", .{field_names[0]});
|
|
}
|
|
|
|
- if (field_???[???] != void) {
|
|
- print(" {s}", .{field_???[???]});
|
|
+ if (field_types[1] != void) {
|
|
+ print(" {s}", .{field_names[1]});
|
|
}
|
|
|
|
- if (field_???[???] != void) {
|
|
- print(" {s}", .{field_???[???]});
|
|
+ if (field_types[2] != void) {
|
|
+ print(" {s}", .{field_names[2]});
|
|
}
|
|
|
|
// Yuck, look at all that repeated code above! I don't know
|