diff options
| author | Dave Gauer <[email protected]> | 2021-04-17 15:56:30 -0400 |
|---|---|---|
| committer | Dave Gauer <[email protected]> | 2021-04-17 15:56:30 -0400 |
| commit | f3e25be7d0ebf010b6152418577e3adac7efd351 (patch) | |
| tree | 29a9d9737a508c4c674a31c840f7840d45f10225 | |
| parent | 0c9ebd941ca3caa6882631847250741f8c7062a2 (diff) | |
| download | ziglings-f3e25be7d0ebf010b6152418577e3adac7efd351.tar.xz ziglings-f3e25be7d0ebf010b6152418577e3adac7efd351.zip | |
Update ex005 because no need for pointers
| -rw-r--r-- | exercises/005_arrays2.zig | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/exercises/005_arrays2.zig b/exercises/005_arrays2.zig index 57b1962..acbfafc 100644 --- a/exercises/005_arrays2.zig +++ b/exercises/005_arrays2.zig @@ -30,17 +30,23 @@ pub fn main() void { // Okay, that's all of the problems. Let's see the results. // // We could print these arrays with leet[0], leet[1],...but let's - // have a little preview of Zig "for" loops instead: + // have a little preview of Zig 'for' loops instead: + // + // for (<item array>) |item| { <do something with item> } + // + // Don't worry, we'll cover looping properly in upcoming + // lessons. + // std.debug.print("LEET: ", .{}); - for (leet) |*n| { - std.debug.print("{}", .{n.*}); + for (leet) |n| { + std.debug.print("{}", .{n}); } std.debug.print(", Bits: ", .{}); - for (bit_pattern) |*n| { - std.debug.print("{}", .{n.*}); + for (bit_pattern) |n| { + std.debug.print("{}", .{n}); } std.debug.print("\n", .{}); |
