mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 22:13:11 -05:00
Merge pull request #208 from chrboesch/issue_140
function made more elegant
This commit is contained in:
commit
5469a7b89f
2 changed files with 5 additions and 8 deletions
|
@ -52,12 +52,9 @@ fn visitElephants(first_elephant: *Elephant) void {
|
||||||
e.print();
|
e.print();
|
||||||
e.visit();
|
e.visit();
|
||||||
|
|
||||||
// This gets the next elephant or stops.
|
// This gets the next elephant or stops:
|
||||||
if (e.hasTail()) {
|
// which method do we want here?
|
||||||
e = e.???; // Which method do we want here?
|
e = if (e.hasTail()) e.??? else break;
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
57c57
|
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;
|
||||||
|
|
Loading…
Reference in a new issue