Add cross references for optional documentation and another example of optional capture in while loop.

This commit is contained in:
Gordon Cassie 2023-12-07 10:53:05 -08:00
parent 56deb5b054
commit cce820f93d

View File

@ -4635,6 +4635,14 @@ test "while null capture" {
} else {
try expect(sum2 == 3);
}
var i: u32 = 0;
var sum3: u32 = 0;
numbers_left = 3;
while (eventuallyNullSequence()) |value| : (i += 1) {
sum3 += value;
}
try expect(i == 3);
}
var numbers_left: u32 = undefined;
@ -6329,6 +6337,8 @@ test "optional pointers" {
}
{#code_end#}
{#header_close#}
{#see_also|while with Optionals|if#}
{#header_close#}
{#header_open|Casting#}
<p>