051_values.patch 819 B

123456789101112131415161718192021222324252627
  1. --- exercises/051_values.zig 2024-03-14 23:25:42.695020607 +0100
  2. +++ answers/051_values.zig 2024-03-14 23:28:34.525109174 +0100
  3. @@ -87,7 +87,7 @@
  4. // Let's assign the std.debug.print function to a const named
  5. // "print" so that we can use this new name later!
  6. - const print = ???;
  7. + const print = std.debug.print;
  8. // Now let's look at assigning and pointing to values in Zig.
  9. //
  10. @@ -163,13 +163,13 @@
  11. print("XP before:{}, ", .{glorp.experience});
  12. // Fix 1 of 2 goes here:
  13. - levelUp(glorp, reward_xp);
  14. + levelUp(&glorp, reward_xp);
  15. print("after:{}.\n", .{glorp.experience});
  16. }
  17. // Fix 2 of 2 goes here:
  18. -fn levelUp(character_access: Character, xp: u32) void {
  19. +fn levelUp(character_access: *Character, xp: u32) void {
  20. character_access.experience += xp;
  21. }