Merge pull request #208 from chrboesch/issue_140

function made more elegant
This commit is contained in:
Chris Boesch 2023-03-30 23:22:09 +02:00 committed by GitHub
commit 5469a7b89f
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;