diff options
| author | Chris Boesch <chrboesch@noreply.codeberg.org> | 2026-02-27 19:44:35 +0100 |
|---|---|---|
| committer | Chris Boesch <chrboesch@noreply.codeberg.org> | 2026-02-27 19:44:35 +0100 |
| commit | d5fdfe708c4ae22c4822a046c54d01f298ae0b11 (patch) | |
| tree | 26b711143cd31e89d3a2489d2ac6ab562e899eea /exercises | |
| parent | 07031c5daac4291e4d23599a944b84e6b434f9c2 (diff) | |
| parent | 88510735e13f8c5cd7bbb2d08ba1cbfd407dca04 (diff) | |
Merge pull request 'emphasize that the end number of a for-loop range is exclusive' (#366) from pebose/exercises:emphasize-for-loop-range into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/366
Diffstat (limited to 'exercises')
| -rw-r--r-- | exercises/095_for3.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/exercises/095_for3.zig b/exercises/095_for3.zig index 0d4f42f..77a1b56 100644 --- a/exercises/095_for3.zig +++ b/exercises/095_for3.zig @@ -28,6 +28,8 @@ // 0..10 is a range from 0 to 9 // 1..4 is a range from 1 to 3 // +// Crucially, the end value is EXCLUSIVE. +// // At the moment, ranges in loops are only supported in 'for' loops. // // Perhaps you recall Exercise 13? We were printing a numeric @@ -64,6 +66,12 @@ pub fn main() void { } std.debug.print("\n", .{}); + + // Let's also print every number from 1 through 15 + for (???) |n| { + std.debug.print("{} ", .{n}); + } + std.debug.print("\n", .{}); } // // That's a bit nicer, right? |
