-
Notifications
You must be signed in to change notification settings - Fork 118
Imperative loop expressions documentation #1364
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
Imperative loop expressions documentation #1364
Conversation
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.
This is quite good, thank you!
Just a small nit about the trailing :s in tip boxes.
| 4. If `test` is false, the `command` expressions in the loop body are evaluated in order. | ||
| 5. Finally, the `step` expressions for each variable are evaluated. All `step` expressions are computed using the variable values from the previous iteration. After all steps are computed, the variables are simultaneously updated with their new values, and the loop proceeds to the next iteration (starting again at step 2). | ||
|
|
||
| ::: tip Examples: |
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.
no need for the trailing : (just Examples), the renderer will create a tip box.
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.
Fixed!
| 4. If `test` is truthy, the `step` expressions are evaluated to compute the new values for the variables, and the loop continues from step 2. | ||
| 5. If `test` is false, the loop terminates. The `result` expressions are then evaluated, and the value of the last one is returned. | ||
|
|
||
| ::: tip Example: |
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.
same here
|
|
||
| This behavior means the loop body may be executed **zero or more times**. If the initial `test` is false, the body will never be executed. The `while` macro always returns a void value. | ||
|
|
||
| ::: tip Example: |
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.
here
|
|
||
| Like [`while`](#while), the loop body may be executed **zero or more times**. The `until` macro always returns a void value. | ||
|
|
||
| ::: tip Example: |
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.
here
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.
thank you!
This PR updates the documentation for the main imperative loop constructs provided by Gerbil: do, do-while, while, and until.
Each entry is organized into the following logical sections:
Note: English is not my native language (I’m a French speaker). The text was written with the help of Gemini and Google Translate.