mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
17 lines
670 B
Diff
17 lines
670 B
Diff
--- exercises/073_comptime8.zig 2023-10-03 22:15:22.125574535 +0200
|
|
+++ answers/073_comptime8.zig 2023-10-05 20:04:07.172769065 +0200
|
|
@@ -32,12 +32,12 @@
|
|
pub fn main() void {
|
|
// We meant to fetch the last llama. Please fix this simple
|
|
// mistake so the assertion no longer fails.
|
|
- const my_llama = getLlama(5);
|
|
+ const my_llama = getLlama(4);
|
|
|
|
print("My llama value is {}.\n", .{my_llama});
|
|
}
|
|
|
|
-fn getLlama(i: usize) u32 {
|
|
+fn getLlama(comptime i: usize) u32 {
|
|
// We've put a guard assert() at the top of this function to
|
|
// prevent mistakes. The 'comptime' keyword here means that
|
|
// the mistake will be caught when we compile!
|