aboutsummaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-06-30 19:18:13 -0400
committerDave Gauer <dave@ratfactor.com>2021-06-30 19:18:13 -0400
commit14f9325408726d090efc958747e6d5d6dc937d85 (patch)
tree7225b8c1e66910a4104bc3dc6e6d0055c84b996f /exercises
parent680e2913f7dc6b6b242e74fd99472b24d57ea3ae (diff)
downloadziglings-14f9325408726d090efc958747e6d5d6dc937d85.tar.gz
ziglings-14f9325408726d090efc958747e6d5d6dc937d85.tar.bz2
ziglings-14f9325408726d090efc958747e6d5d6dc937d85.tar.xz
ziglings-14f9325408726d090efc958747e6d5d6dc937d85.zip
methods NOT namespaced like i expected
Diffstat (limited to 'exercises')
-rw-r--r--exercises/058_quiz7.zig9
1 files changed, 3 insertions, 6 deletions
diff --git a/exercises/058_quiz7.zig b/exercises/058_quiz7.zig
index 59b48ba..7162078 100644
--- a/exercises/058_quiz7.zig
+++ b/exercises/058_quiz7.zig
@@ -176,11 +176,8 @@ const TripItem = union(enum) {
path: *const Path,
// This is a little helper function to print the two different
- // types of item correctly. Note how this "print()" is namespaced
- // to the TripItem union and doesn't interfere with calling the
- // "print()" from the standard library we imported at the top of
- // this program.
- fn print(self: TripItem) void {
+ // types of item correctly.
+ fn printMe(self: TripItem) void {
switch (self) {
// Oops! The hermit forgot how to capture the union values
// in a switch statement. Please capture both values as
@@ -427,7 +424,7 @@ fn printTrip(trip: []?TripItem) void {
while (i > 0) {
i -= 1;
if (trip[i] == null) continue;
- trip[i].?.print();
+ trip[i].?.printMe();
}
print("\n", .{});