diff options
Diffstat (limited to 'exercises/068_comptime3.zig')
| -rw-r--r-- | exercises/068_comptime3.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/exercises/068_comptime3.zig b/exercises/068_comptime3.zig index bb82778..919a6ed 100644 --- a/exercises/068_comptime3.zig +++ b/exercises/068_comptime3.zig @@ -43,7 +43,9 @@ const Schooner = struct { // // Please change this so that it sets a 0 scale to 1 // instead. - if (my_scale == 0) @compileError("Scale 1:0 is not valid!"); + if (my_scale == 0) { + my_scale = 1; + } self.scale = my_scale; self.hull_length /= my_scale; @@ -69,7 +71,7 @@ pub fn main() void { // Hey, we can't just pass this runtime variable as an // argument to the scaleMe() method. What would let us do // that? - var scale: u32 = undefined; + comptime var scale: u32 = undefined; scale = 32; // 1:32 scale |
