aboutsummaryrefslogtreecommitdiff
path: root/exercises/005_arrays2.zig
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-04-17 15:56:30 -0400
committerDave Gauer <dave@ratfactor.com>2021-04-17 15:56:30 -0400
commit2061140ef678c7ef80baa6baed0d888893c0bf67 (patch)
tree29a9d9737a508c4c674a31c840f7840d45f10225 /exercises/005_arrays2.zig
parentb2cb0dab4680ce9c05e633391ce0609fcbc39178 (diff)
downloadziglings-2061140ef678c7ef80baa6baed0d888893c0bf67.tar.gz
ziglings-2061140ef678c7ef80baa6baed0d888893c0bf67.tar.bz2
ziglings-2061140ef678c7ef80baa6baed0d888893c0bf67.tar.xz
ziglings-2061140ef678c7ef80baa6baed0d888893c0bf67.zip
Update ex005 because no need for pointers
Diffstat (limited to 'exercises/005_arrays2.zig')
-rw-r--r--exercises/005_arrays2.zig16
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", .{});