From adf5ddb27df7f5a22b0b7d3321dfc8bca1e7937a Mon Sep 17 00:00:00 2001 From: Dave Gauer Date: Sun, 7 Feb 2021 11:06:51 -0500 Subject: 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. --- 15_for.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to '15_for.zig') 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. -- cgit v1.2.3-ZIG