mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 07:50:00 +00:00
Added ex 48, additional comment on 46
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
12c12
|
||||
< tail: *Elephant = null, // <---- make this optional!
|
||||
8,19d7
|
||||
< // We also introduce the handy ".?" shortcut:
|
||||
< //
|
||||
< // const foo = bar.?;
|
||||
< //
|
||||
< // is the same as
|
||||
< //
|
||||
< // const foo = bar orelse unreachable;
|
||||
< //
|
||||
< // See if you can find where we use this shortcut below.
|
||||
< //
|
||||
< // Now let's make those elephant tails optional!
|
||||
< //
|
||||
24c12
|
||||
< tail: *Elephant = null, // Hmm... tail needs something...
|
||||
---
|
||||
> tail: ?*Elephant = null, // <---- make this optional!
|
||||
42c42
|
||||
54c42
|
||||
< if (e.tail == null) ???;
|
||||
---
|
||||
> if (e.tail == null) break;
|
||||
|
||||
4
patches/patches/48_methods2.patch
Normal file
4
patches/patches/48_methods2.patch
Normal file
@@ -0,0 +1,4 @@
|
||||
57c57
|
||||
< e = e.???; // Which method do we want here?
|
||||
---
|
||||
> e = e.getTail(); // Which method do we want here?
|
||||
Reference in New Issue
Block a user