zig/doc/langref/handle_error_with_catch_block.zig.zig

12 lines
256 B
Zig

const parseU64 = @import("error_union_parsing_u64.zig").parseU64;
fn doAThing(str: []u8) void {
const number = parseU64(str, 10) catch blk: {
// do things
break :blk 13;
};
_ = number; // number is now initialized
}
// syntax