diff --git a/doc/langref.html.in b/doc/langref.html.in index c208a76ce62f13c4dc40775f3920ba18cfb78130..3d3294e1e5347d9ff753ccfb5fec3c03ed801d2c 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -3025,7 +3025,7 @@ or {#syntax#}catch{#endsyntax#} after performing some logic, you can combine {#syntax#}catch{#endsyntax#} with named {#link|Blocks#}:
- {#code|handle_error_with_catch_block.zig.zig#} + {#code|handle_error_with_catch_block.zig#} {#header_close#} {#header_open|try#} diff --git a/doc/langref/handle_error_with_catch_block.zig b/doc/langref/handle_error_with_catch_block.zig new file mode 100644 index 0000000000000000000000000000000000000000..afc4309021ea121f13f11c9b68002ba5d37d605e --- /dev/null +++ b/doc/langref/handle_error_with_catch_block.zig @@ -0,0 +1,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 diff --git a/doc/langref/handle_error_with_catch_block.zig.zig b/doc/langref/handle_error_with_catch_block.zig.zig deleted file mode 100644 index afc4309021ea121f13f11c9b68002ba5d37d605e..0000000000000000000000000000000000000000 --- a/doc/langref/handle_error_with_catch_block.zig.zig +++ /dev/null @@ -1,11 +0,0 @@ -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