unused consts now errors

This commit is contained in:
Dave Gauer 2021-06-30 19:00:50 -04:00
parent a84677d798
commit 843fd65882
3 changed files with 10 additions and 15 deletions

View file

@ -69,17 +69,12 @@ pub fn main() void {
.gold = 30, .gold = 30,
}; };
// However, this "skull_farmer" character will be put in the // The "reward_xp" value is interesting. It's an immutable
// global immutable data even though it's defined in a function. // value, so even though it is local, it can be put in global
// Since it's immutable, all invocations of the function can share // data and shared between all invocations. But being such a
// this one value. // small value, it may also simply be inlined as a literal
// value in your instruction code where it is used. It's up
const skull_farmer = Character{}; // to the compiler.
// The "reward_xp" value is interesting. It's a constant value, so
// it could go with other global data. But being such a small
// value, it may also simply be inlined as a literal value in your
// instruction code where it is used. It's up to the compiler.
const reward_xp: u32 = 200; const reward_xp: u32 = 200;

View file

@ -1,2 +1,2 @@
36a37 35a36
> MyNumberError.TooSmall => std.debug.print("<4. ", .{}), > MyNumberError.TooSmall => std.debug.print("<4. ", .{}),

View file

@ -1,12 +1,12 @@
95c95 90c90
< const print = ???; < const print = ???;
--- ---
> const print = std.debug.print; > const print = std.debug.print;
160c160 155c155
< levelUp(glorp, reward_xp); < levelUp(glorp, reward_xp);
--- ---
> levelUp(&glorp, reward_xp); > levelUp(&glorp, reward_xp);
166c166 161c161
< fn levelUp(character_access: Character, xp: u32) void { < fn levelUp(character_access: Character, xp: u32) void {
--- ---
> fn levelUp(character_access: *Character, xp: u32) void { > fn levelUp(character_access: *Character, xp: u32) void {