Skip to content
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

fix an error in loops.md #387

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix an error in loops.md #387

wants to merge 1 commit into from

Conversation

bacher
Copy link

@bacher bacher commented Aug 19, 2024

In the current example the loop runs infinitely, without printing anything.

In the current example loop run infinitely, without printing anything.
Copy link
Member

@spotandjake spotandjake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I think it might be better if we switch to using a for loop here though.

@@ -23,7 +23,10 @@ Loops can skip to the next iteration using the `continue` keyword. For example,
let mut i = 0

while (i < 10) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be better if we use a for loop here.

for (let mut i = 0; i <= 10; i += 1) {
  if (i % 2 == 0) continue;
  print(i)
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, definitely!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Therefore this code snippet should be moved into for loop section.

So feel free to close my PR and make your own changes, or make changes here.

I do not feel experienced enough to change the structure of this documentation.

Copy link

netlify bot commented Aug 19, 2024

Deploy preview ready! 🌾

Name Link
🔨 Latest commit e99c0cc
🔍 Latest deploy log https://app.netlify.com/sites/grain-lang/deploys/66c3b03ee1e7460008a6e1e1
😎 Deploy Preview https://deploy-preview-387--grain-lang.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants