From 5257941f40554da3f8df074443a4c087dcff7004 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Sat, 10 Dec 2022 23:02:40 +0000 Subject: 25-60 complete --- exercises/057_unions3.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'exercises/057_unions3.zig') diff --git a/exercises/057_unions3.zig b/exercises/057_unions3.zig index 142180f..860c979 100644 --- a/exercises/057_unions3.zig +++ b/exercises/057_unions3.zig @@ -15,7 +15,7 @@ // const std = @import("std"); -const Insect = union(InsectStat) { +const Insect = union(enum) { flowers_visited: u16, still_alive: bool, }; @@ -24,6 +24,8 @@ pub fn main() void { var ant = Insect{ .still_alive = true }; var bee = Insect{ .flowers_visited = 17 }; + //ant.flowers_visited = 26; // wow 'terminated unexpectedly' isn't super helpful error + std.debug.print("Insect report! ", .{}); printInsect(ant); -- cgit v1.2.3-ZIG