-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat(foreach): ✨ add statement to exit from a foreach loop #841
Conversation
src/lua/zencode_foreach.lua
Outdated
@@ -64,3 +64,8 @@ Foreach("'' in sequence from '' to '' with step ''", function(name, from_name, t | |||
end | |||
end | |||
end) | |||
|
|||
When("exit from foreach loop", function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best use:
exit foreach loop
which will support also exit the
unsure if to use break
as a verb, more used in other langs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had also the same doubt about using exit
or break
, maybe break foreach loop
can be a better solution, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are unsure qe can have them as alias both exit
and break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes to aliasing both exit
and break
.
I checked and the word loop
is not mentioned anywhere so:
break foreach
exit foreach
One doubt left since endforeach
is used as one word to mark end of branch... I think there will be confusion later on about having the word separated, as well between exit
and end
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main difference between exit/break foreach and endforeach is that the former is a When statement, i.e.
When I break the foreach
While the latter is just a keyword to mark the end of the code to be repeated in a foreach loop.
To me this separation make sense
Add also break alias
…aving the shcema in the iterator codec when present
I think my doubts can be set aside and as you say it seems coherent to break inside a statement rather than prefix. Merging. Very well done! |
No description provided.