aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/handle_error_with_catch_block.zig
blob: afc4309021ea121f13f11c9b68002ba5d37d605e (plain)
1
2
3
4
5
6
7
8
9
10
11
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