From 0e447c7956410a993614f9337d6219e017722443 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Fri, 9 Dec 2022 22:07:01 +0000 Subject: 001-024 complete --- exercises/020_quiz3.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'exercises/020_quiz3.zig') diff --git a/exercises/020_quiz3.zig b/exercises/020_quiz3.zig index 651af8c..267c991 100644 --- a/exercises/020_quiz3.zig +++ b/exercises/020_quiz3.zig @@ -21,8 +21,8 @@ pub fn main() void { // // This function prints, but does not return anything. // -fn printPowersOfTwo(numbers: [4]u16) ??? { - loop (numbers) |n| { +fn printPowersOfTwo(numbers: [4]u16) void { + for (numbers) |n| { std.debug.print("{} ", .{twoToThe(n)}); } } @@ -31,13 +31,13 @@ fn printPowersOfTwo(numbers: [4]u16) ??? { // exercise. But don't be fooled! This one does the math without the aid // of the standard library! // -fn twoToThe(number: u16) ??? { +fn twoToThe(number: u16) u16 { var n: u16 = 0; var total: u16 = 1; - loop (n < number) : (n += 1) { + while (n < number) : (n += 1) { total *= 2; } - return ???; + return total; } -- cgit v1.2.3-ZIG