mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 22:09:49 +00:00
docs: add comment about for else and break
This commit is contained in:
parent
5784631fab
commit
404e4b0268
@ -3293,6 +3293,7 @@ test "for else" {
|
||||
var items = []?i32 { 3, 4, null, 5 };
|
||||
|
||||
// For loops can also be used as expressions.
|
||||
// Similar to while loops, when you break from a for loop, the else branch is not evaluated.
|
||||
var sum: i32 = 0;
|
||||
const result = for (items) |value| {
|
||||
if (value == null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user