From 0e447c7956410a993614f9337d6219e017722443 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Fri, 9 Dec 2022 22:07:01 +0000 Subject: 001-024 complete --- exercises/022_errors2.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'exercises/022_errors2.zig') 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? -- cgit v1.2.3-ZIG