diff options
| author | Dave Gauer <dave@ratfactor.com> | 2021-02-07 11:06:51 -0500 |
|---|---|---|
| committer | Dave Gauer <dave@ratfactor.com> | 2021-02-07 11:06:51 -0500 |
| commit | adf5ddb27df7f5a22b0b7d3321dfc8bca1e7937a (patch) | |
| tree | a25511c3bb20069f1d6123366573c82c5745338b /15_for.zig | |
| parent | 507355ec3b1066c707e19816b86ac1fb56fc0385 (diff) | |
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.zig | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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. |
