File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- 46
1+ 49
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ pub fn main() void {
8888 for (& aliens ) | * alien | {
8989
9090 // *** Zap the alien with the heat ray here! ***
91- ??? .zap (??? );
91+ heat_ray .zap (alien );
9292
9393 // If the alien's health is still above 0, it's still alive.
9494 if (alien .health > 0 ) aliens_alive += 1 ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ fn visitElephants(first_elephant: *Elephant) void {
5454
5555 // This gets the next elephant or stops:
5656 // which method do we want here?
57- e = if (e .hasTail ()) e .??? else break ;
57+ e = if (e .hasTail ()) e .getTail () else break ;
5858 }
5959}
6060
Original file line number Diff line number Diff line change @@ -27,8 +27,12 @@ const Elephant = struct {
2727 // Your Elephant trunk methods go here!
2828 // ---------------------------------------------------
2929
30- ???
31-
30+ pub fn hasTrunk (self : * Elephant ) bool {
31+ return self .trunk != null ;
32+ }
33+ pub fn getTrunk (self : * Elephant ) * Elephant {
34+ return self .trunk .? ;
35+ }
3236 // ---------------------------------------------------
3337
3438 pub fn visit (self : * Elephant ) void {
You can’t perform that action at this time.
0 commit comments