1
0
Fork 0
mirror of https://github.com/ratfactor/ziglings synced 2024-05-05 01:56:03 +02:00

function made more elegant

This commit is contained in:
Chris Boesch 2023-03-30 23:11:40 +02:00
parent e9735900ae
commit a3b2a58eab
2 changed files with 5 additions and 8 deletions

View File

@ -52,12 +52,9 @@ fn visitElephants(first_elephant: *Elephant) void {
e.print();
e.visit();
// This gets the next elephant or stops.
if (e.hasTail()) {
e = e.???; // Which method do we want here?
} else {
break;
}
// This gets the next elephant or stops:
// which method do we want here?
e = if (e.hasTail()) e.??? else break;
}
}

View File

@ -1,4 +1,4 @@
57c57
< e = e.???; // Which method do we want here?
< e = if (e.hasTail()) e.??? else break;
---
> e = e.getTail(); // Which method do we want here?
> e = if (e.hasTail()) e.getTail() else break;