A labeled block gives a scope a name and can yield a value without a separate function. Write the label before the block, as in `a: { ... }`, and exit it with `break :a value`. Labels also distinguish nested blocks. section 4.1.3
Listing 4.5 Using labels
const result: i32 = a: {
const some_resource: Resource = .init();
defer some_resource.deinit(); #1
if (some_resource.some_condition()) {
break :a 0;
}
break :a 1;
};
The block yields either 0 or 1 while keeping resource cleanup inside its scope. section 4.1.3
Listing 4.6 Using our parser
const words = blk: { #1
@setEvalBranchQuota(1_000_000); #2
break :blk parseWordlist(@embedFile("words.txt")); #3
};
A labeled block sets the compile-time branch quota and yields the parsed contents of an embedded wordlist. section 4.1.3
