Learning Zig from the official language reference.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
zig-langref/labelled_while.zig

24 lines
475 B

const std = @import("std");
const testing = std.testing;
test "nested break" {
var i: usize = 0;
var j: usize = 1;
outer: while (i < 100) : (i += 1) {
while (j < 100) : (j *= 2) {
if (i * j > 100) break :outer;
}
}
}
test "nested continue" {
var i: usize = 0;
var j: usize = 1;
outer: while (i < 100) : (i += 1) {
while (j < 100) : (j *= 2) {
if (i * j < 100) continue :outer;
}
}
}