aboutsummaryrefslogtreecommitdiff
path: root/exercises/057_unions3.zig
diff options
context:
space:
mode:
authorMartin Ashby <martin@ashbysoft.com>2022-12-10 23:02:40 +0000
committerMartin Ashby <martin@ashbysoft.com>2022-12-10 23:02:40 +0000
commit5257941f40554da3f8df074443a4c087dcff7004 (patch)
treeb55af272f52f961f8fa02468861de2c255d8a9e2 /exercises/057_unions3.zig
parent0e447c7956410a993614f9337d6219e017722443 (diff)
downloadziglings-main.tar.gz
ziglings-main.tar.bz2
ziglings-main.tar.xz
ziglings-main.zip
25-60 completemain
Diffstat (limited to 'exercises/057_unions3.zig')
-rw-r--r--exercises/057_unions3.zig4
1 files changed, 3 insertions, 1 deletions
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);