zig/doc/langref/test_labeled_break.zig

16 lines
269 B
Zig
Raw Normal View History

const std = @import("std");
const expect = std.testing.expect;
test "labeled break from labeled block expression" {
var y: i32 = 123;
const x = blk: {
y += 1;
break :blk y;
};
try expect(x == 124);
try expect(y == 124);
}
// test