aboutsummaryrefslogtreecommitdiff
path: root/exercises/022_errors2.zig
diff options
context:
space:
mode:
Diffstat (limited to 'exercises/022_errors2.zig')
-rw-r--r--exercises/022_errors2.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/exercises/022_errors2.zig b/exercises/022_errors2.zig
index 1d513b3..0797491 100644
--- a/exercises/022_errors2.zig
+++ b/exercises/022_errors2.zig
@@ -18,8 +18,12 @@ const std = @import("std");
const MyNumberError = error{TooSmall};
+fn foo() u32!u16 { // unions of any type are allowed it seems
+ return @intCast(u32, 12);
+}
+
pub fn main() void {
- var my_number: ??? = 5;
+ var my_number: MyNumberError!u16 = 5;
// Looks like my_number will need to either store a number OR
// an error. Can you set the type correctly above?