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 /09_if.zig | |
parent | 507355ec3b1066c707e19816b86ac1fb56fc0385 (diff) | |
download | ziglings-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 '09_if.zig')
-rw-r--r-- | 09_if.zig | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -1,19 +1,19 @@ // // Now we get into the fun stuff, starting with the 'if' statement! // -// if (true) { -// // stuff -// } else { -// // other stuff -// } +// if (true) { +// ... +// } else { +// ... +// } // -// Zig has the usual comparison operators such as: +// Zig has the "usual" comparison operators such as: // -// a == b a equals b -// a < b a is less than b -// a !=b a does not equal b +// a == b means "a equals b" +// a < b means "a is less than b" +// a !=b means "a does not equal b" // -// The important thing about Zig's 'if' is that it *only* accepts +// The important thing about Zig's "if" is that it *only* accepts // boolean values. It won't coerce numbers or other types of data // to true and false. // @@ -22,6 +22,7 @@ const std = @import("std"); pub fn main() void { const foo = 1; + // Please fix this condition: if (foo) { // We want out program to print this message! std.debug.print("Foo is 1!\n", .{}); |