aboutsummaryrefslogtreecommitdiff
path: root/exercises/037_structs.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/037_structs.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/037_structs.zig')
-rw-r--r--exercises/037_structs.zig7
1 files changed, 2 insertions, 5 deletions
diff --git a/exercises/037_structs.zig b/exercises/037_structs.zig
index 32f7b41..0b6242f 100644
--- a/exercises/037_structs.zig
+++ b/exercises/037_structs.zig
@@ -36,15 +36,12 @@ const Character = struct {
class: Class,
gold: u32,
experience: u32,
+ health: u8,
};
pub fn main() void {
// Please initialize Glorp with 100 health.
- var glorp_the_wise = Character{
- .class = Class.wizard,
- .gold = 20,
- .experience = 10,
- };
+ var glorp_the_wise = Character{ .class = Class.wizard, .gold = 20, .experience = 10, .health = 100 };
// Glorp gains some gold.
glorp_the_wise.gold += 5;