aboutsummaryrefslogtreecommitdiff
path: root/15_for.zig
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-02-07 11:06:51 -0500
committerDave Gauer <dave@ratfactor.com>2021-02-07 11:06:51 -0500
commitadf5ddb27df7f5a22b0b7d3321dfc8bca1e7937a (patch)
treea25511c3bb20069f1d6123366573c82c5745338b /15_for.zig
parent507355ec3b1066c707e19816b86ac1fb56fc0385 (diff)
downloadziglings-adf5ddb27df7f5a22b0b7d3321dfc8bca1e7937a.tar.gz
ziglings-adf5ddb27df7f5a22b0b7d3321dfc8bca1e7937a.tar.bz2
ziglings-adf5ddb27df7f5a22b0b7d3321dfc8bca1e7937a.tar.xz
ziglings-adf5ddb27df7f5a22b0b7d3321dfc8bca1e7937a.zip
Consistent instructions and examples
I started off with "hints" that required the poor student to piece together the information from incomplete bits. A complete example is like a picture that is worth 1000 words and far clearer.
Diffstat (limited to '15_for.zig')
-rw-r--r--15_for.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/15_for.zig b/15_for.zig
index 51ab67f..652478b 100644
--- a/15_for.zig
+++ b/15_for.zig
@@ -1,10 +1,11 @@
//
// Behold the 'for' loop! It lets you execute code for each
-// member of an array (and things called 'slices' which we'll
-// get to in a bit).
+// member of an array:
//
// for (items) |item| {
+//
// // Do something with item
+//
// }
//
const std = @import("std");
@@ -22,3 +23,6 @@ pub fn main() void {
std.debug.print("The End.\n", .{});
}
+//
+// Note that "for" loops also work on things called "slices"
+// which we'll see later.