mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-10 17:09:59 +00:00
Clarify 048,049 comments from instructions (issue #48)
This commit is contained in:
@@ -34,7 +34,7 @@ pub fn main() void {
|
|||||||
var elephantB = Elephant{ .letter = 'B' };
|
var elephantB = Elephant{ .letter = 'B' };
|
||||||
var elephantC = Elephant{ .letter = 'C' };
|
var elephantC = Elephant{ .letter = 'C' };
|
||||||
|
|
||||||
// Link the elephants so that each tail "points" to the next.
|
// This links the elephants so that each tail "points" to the next.
|
||||||
elephantA.tail = &elephantB;
|
elephantA.tail = &elephantB;
|
||||||
elephantB.tail = &elephantC;
|
elephantB.tail = &elephantC;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ fn visitElephants(first_elephant: *Elephant) void {
|
|||||||
e.print();
|
e.print();
|
||||||
e.visit();
|
e.visit();
|
||||||
|
|
||||||
// Get the next elephant or stop.
|
// This gets the next elephant or stops.
|
||||||
if (e.hasTail()) {
|
if (e.hasTail()) {
|
||||||
e = e.???; // Which method do we want here?
|
e = e.???; // Which method do we want here?
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub fn main() void {
|
|||||||
var elephantB = Elephant{ .letter = 'B' };
|
var elephantB = Elephant{ .letter = 'B' };
|
||||||
var elephantC = Elephant{ .letter = 'C' };
|
var elephantC = Elephant{ .letter = 'C' };
|
||||||
|
|
||||||
// Link the elephants so that each tail "points" to the next.
|
// We link the elephants so that each tail "points" to the next.
|
||||||
elephantA.tail = &elephantB;
|
elephantA.tail = &elephantB;
|
||||||
elephantB.tail = &elephantC;
|
elephantB.tail = &elephantC;
|
||||||
|
|
||||||
@@ -64,12 +64,12 @@ pub fn main() void {
|
|||||||
fn visitElephants(first_elephant: *Elephant) void {
|
fn visitElephants(first_elephant: *Elephant) void {
|
||||||
var e = first_elephant;
|
var e = first_elephant;
|
||||||
|
|
||||||
// Follow the tails!
|
// We follow the tails!
|
||||||
while (true) {
|
while (true) {
|
||||||
e.print();
|
e.print();
|
||||||
e.visit();
|
e.visit();
|
||||||
|
|
||||||
// Get the next elephant or stop.
|
// This gets the next elephant or stops.
|
||||||
if (e.hasTail()) {
|
if (e.hasTail()) {
|
||||||
e = e.getTail();
|
e = e.getTail();
|
||||||
} else {
|
} else {
|
||||||
@@ -77,11 +77,11 @@ fn visitElephants(first_elephant: *Elephant) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Follow the trunks!
|
// We follow the trunks!
|
||||||
while (true) {
|
while (true) {
|
||||||
e.print();
|
e.print();
|
||||||
|
|
||||||
// Get the previous elephant or stop.
|
// This gets the previous elephant or stops.
|
||||||
if (e.hasTrunk()) {
|
if (e.hasTrunk()) {
|
||||||
e = e.getTrunk();
|
e = e.getTrunk();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user