| ... | ... | @@ -4,6 +4,11 @@ const std = @import("std"); |
| 4 | 4 | const os = std.os; |
| 5 | 5 | const assert = std.debug.assert; |
| 6 | 6 | |
| 7 | // Custom error set definition: |
| 8 | const ExampleErrorSet = error{ |
| 9 | ExampleErrorVariant, |
| 10 | }; |
| 11 | |
| 7 | 12 | pub fn main() void { |
| 8 | 13 | // integers |
| 9 | 14 | const one_plus_one: i32 = 1 + 1; |
| ... | ... | @@ -36,7 +41,7 @@ pub fn main() void { |
| 36 | 41 | }); |
| 37 | 42 | |
| 38 | 43 | // error union |
| 39 | | var number_or_error: anyerror!i32 = error.ArgNotFound; |
| 44 | var number_or_error: ExampleErrorSet!i32 = ExampleErrorSet.ExampleErrorVariant; |
| 40 | 45 | |
| 41 | 46 | print("\nerror union 1\ntype: {}\nvalue: {!}\n", .{ |
| 42 | 47 | @TypeOf(number_or_error), |