zig/test/cases/for.zig

15 lines
261 B
Zig
Raw Normal View History

fn continueInForLoop() {
@setFnTest(this);
const array = []i32 {1, 2, 3, 4, 5};
var sum : i32 = 0;
for (array) |x| {
sum += x;
if (x < 3) {
continue;
}
break;
}
if (sum != 6) @unreachable()
}