diff options
author | Dave Gauer <ratfactor@gmail.com> | 2022-04-22 20:51:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 20:51:43 -0400 |
commit | f72c2aa5341ccbe259f7ac655953386e9441d9ee (patch) | |
tree | 14e0055a1560df0d38e52387035c5306812f44c5 /exercises/062_loop_expressions.zig | |
parent | e11daf808d405b62f6aeaf89be4b14df0163b0a5 (diff) | |
parent | 3482911947c5c940ea42803241776043edb6e121 (diff) | |
download | ziglings-f72c2aa5341ccbe259f7ac655953386e9441d9ee.tar.gz ziglings-f72c2aa5341ccbe259f7ac655953386e9441d9ee.tar.bz2 ziglings-f72c2aa5341ccbe259f7ac655953386e9441d9ee.tar.xz ziglings-f72c2aa5341ccbe259f7ac655953386e9441d9ee.zip |
Merge pull request #95 from ziyi-yan/main
fix loop else clause explanation
Diffstat (limited to 'exercises/062_loop_expressions.zig')
-rw-r--r-- | exercises/062_loop_expressions.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/exercises/062_loop_expressions.zig b/exercises/062_loop_expressions.zig index a40b622..f6b8771 100644 --- a/exercises/062_loop_expressions.zig +++ b/exercises/062_loop_expressions.zig @@ -13,8 +13,8 @@ // But what value is returned from a loop if a break statement is // never reached? We need a default expression. Thankfully, Zig // loops also have 'else' clauses! As you might have guessed, the -// else clause is evaluated once a while condition becomes false -// or a for loop runs out of items. +// 'else' clause is evaluated when: 1) a 'while' condition becomes +// false or 2) a 'for' loop runs out of items. // // const two: u8 = while (true) break 2 else 0; // 2 // const three: u8 = for ([1]u8{1}) |f| break 3 else 0; // 3 |