zig/doc/langref/test_while_break.zig

14 lines
207 B
Zig

const expect = @import("std").testing.expect;
test "while break" {
var i: usize = 0;
while (true) {
if (i == 10)
break;
i += 1;
}
try expect(i == 10);
}
// test