| author | |
| committer | |
| log | 0ec45050e0e5f503ebd35473e797ab73f8e64f09 |
| tree | e84a373285a3d1dd0868794f141416a344320b3e |
| parent | bd1e960bc0d20013d9458d35318c46e40bd8ff59 |
3 files changed, 12 insertions(+), 12 deletions(-)
doc/langref.html.in+1-1| ... | @@ -3025,7 +3025,7 @@ or | ... | @@ -3025,7 +3025,7 @@ or |
| 3025 | {#syntax#}catch{#endsyntax#} after performing some logic, you | 3025 | {#syntax#}catch{#endsyntax#} after performing some logic, you |
| 3026 | can combine {#syntax#}catch{#endsyntax#} with named {#link|Blocks#}: | 3026 | can combine {#syntax#}catch{#endsyntax#} with named {#link|Blocks#}: |
| 3027 | </p> | 3027 | </p> |
| 3028 | {#code|handle_error_with_catch_block.zig.zig#} | 3028 | {#code|handle_error_with_catch_block.zig#} |
| 3029 | 3029 | ||
| 3030 | {#header_close#} | 3030 | {#header_close#} |
| 3031 | {#header_open|try#} | 3031 | {#header_open|try#} |
doc/langref/handle_error_with_catch_block.zig created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | const parseU64 = @import("error_union_parsing_u64.zig").parseU64; | ||
| 2 | |||
| 3 | fn doAThing(str: []u8) void { | ||
| 4 | const number = parseU64(str, 10) catch blk: { | ||
| 5 | // do things | ||
| 6 | break :blk 13; | ||
| 7 | }; | ||
| 8 | _ = number; // number is now initialized | ||
| 9 | } | ||
| 10 | |||
| 11 | // syntax | ||
doc/langref/handle_error_with_catch_block.zig.zig deleted-11| ... | @@ -1,11 +0,0 @@ | ||
| 1 | const parseU64 = @import("error_union_parsing_u64.zig").parseU64; | ||
| 2 | |||
| 3 | fn doAThing(str: []u8) void { | ||
| 4 | const number = parseU64(str, 10) catch blk: { | ||
| 5 | // do things | ||
| 6 | break :blk 13; | ||
| 7 | }; | ||
| 8 | _ = number; // number is now initialized | ||
| 9 | } | ||
| 10 | |||
| 11 | // syntax | ||