aboutsummaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-04-17 17:44:07 -0400
committerDave Gauer <dave@ratfactor.com>2021-04-17 17:44:07 -0400
commitb347a072769d6d20d5d901b023e4c57e6d0eb90c (patch)
tree94180bb079cb6cb7d6b5e86cc4af0df4d619ff37 /exercises
parent1355f550fb1ad128a7cc744f34a4f53874ae3730 (diff)
downloadziglings-b347a072769d6d20d5d901b023e4c57e6d0eb90c.tar.gz
ziglings-b347a072769d6d20d5d901b023e4c57e6d0eb90c.tar.bz2
ziglings-b347a072769d6d20d5d901b023e4c57e6d0eb90c.tar.xz
ziglings-b347a072769d6d20d5d901b023e4c57e6d0eb90c.zip
Make it super clear there are two fixes in 051
Diffstat (limited to 'exercises')
-rw-r--r--exercises/051_values.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/exercises/051_values.zig b/exercises/051_values.zig
index dd68d3b..956b742 100644
--- a/exercises/051_values.zig
+++ b/exercises/051_values.zig
@@ -14,7 +14,7 @@
// from the standard library is added to your program and compiled
// with it. All of this will be loaded into RAM when it runs. Oh, and
// that thing we name "const std"? That's a struct!
-
+//
const std = @import("std");
// Remember our old RPG Character struct? A struct is really just a
@@ -150,17 +150,19 @@ pub fn main() void {
// making an assignment to a const (since Zig enforces that ALL
// function parameters are const).
//
- // Knowing that, see if you can make levelUp() work as expected -
+ // Knowing this, see if you can make levelUp() work as expected -
// it should add the specified amount to the supplied character's
- // experience points:
-
+ // experience points.
+ //
print("XP before:{}, ", .{glorp.experience});
+ // Fix 1 of 2 goes here:
levelUp(glorp, reward_xp);
print("after:{}.\n", .{glorp.experience});
}
+// Fix 2 of 2 goes here:
fn levelUp(character_access: Character, xp: u32) void {
character_access.experience += xp;
}