fix: The arguments of the commented out linkElephants call are in the

wrong order to demonstrate the wanted behavior.

It is intended to show that the .? operator will panic if it is called
on null, but the null elephant is passed as the second argument which
may be null (and on which .? is not called).
This commit is contained in:
Nicholas Schwab 2024-08-14 19:41:01 +02:00
parent 118c1252be
commit 4f96fa639d

View File

@ -38,7 +38,7 @@ pub fn main() void {
// `linkElephants` will stop the program if you try and link an // `linkElephants` will stop the program if you try and link an
// elephant that doesn't exist! Uncomment and see what happens. // elephant that doesn't exist! Uncomment and see what happens.
// const missingElephant: ?*Elephant = null; // const missingElephant: ?*Elephant = null;
// linkElephants(&elephantC, missingElephant); // linkElephants(missingElephant, &elephantC);
visitElephants(&elephantA); visitElephants(&elephantA);