From 6ad9774189fbd64b2f2c9519f4513ab34b0c3809 Mon Sep 17 00:00:00 2001 From: Dave Gauer Date: Fri, 12 Mar 2021 18:59:46 -0500 Subject: "999 is enough for anybody" triple-zero padding (#18) When I hit 999 exercises, I will finally have reached the ultimate state of soteriological release and no more exercises will be needed. The cycle will be complete. All that will be left is perfect quietude, freedom, and highest happiness. --- exercises/38_structs2.zig | 52 ----------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 exercises/38_structs2.zig (limited to 'exercises/38_structs2.zig') diff --git a/exercises/38_structs2.zig b/exercises/38_structs2.zig deleted file mode 100644 index b0db022..0000000 --- a/exercises/38_structs2.zig +++ /dev/null @@ -1,52 +0,0 @@ -// -// Grouping values in structs is not merely convenient. It also allows -// us to treat the values as a single item when storing them, passing -// them to functions, etc. -// -// This exercise demonstrates how we can store structs in an array and -// how doing so lets us print them all (both) using a loop. -// -const std = @import("std"); - -const Class = enum { - wizard, - thief, - bard, - warrior, -}; - -const Character = struct { - class: Class, - gold: u32, - health: u8, - experience: u32, -}; - -pub fn main() void { - var chars: [2]Character = undefined; - - // Glorp the Wise - chars[0] = Character{ - .class = Class.wizard, - .gold = 20, - .health = 100, - .experience = 10, - }; - - // Please add "Zump the Loud" with the following properties: - // - // class bard - // gold 10 - // health 100 - // experience 20 - // - // Feel free to run this program without adding Zump. What does - // it do and why? - - // Printing all RPG characters in a loop: - for (chars) |c, num| { - std.debug.print("Character {} - G:{} H:{} XP:{}\n", .{ - num + 1, c.gold, c.health, c.experience, - }); - } -} -- cgit v1.2.3-ZIG