-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support else statements for for loops #27
Comments
Under what circumstances does the 'else' execute? I always found the concept of an 'else' on a loop to be unclear. Is it if we break, or if the condition becomes false (i.e. we don't break), or if the loop body doesn't execute at all? |
I was thinking that they would act as they do in Python; see here. The summary:
This is useful when searching for something with a loop; if you find it you break; if you fail, you run the else statement. |
Okay, I do see why that's useful. Is there a more clever name for it than 'else'? |
Yes. Clearly, it should be:
|
On IRC there was a suggestion of separate keywords for the two cases--perhaps I think this would also allow |
No description provided.
The text was updated successfully, but these errors were encountered: