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

Minor documentation request for 'next' #4365

Closed
drosehn opened this issue May 1, 2017 · 2 comments
Closed

Minor documentation request for 'next' #4365

drosehn opened this issue May 1, 2017 · 2 comments

Comments

@drosehn
Copy link

drosehn commented May 1, 2017

In the description for next at:

https://crystal-lang.org/docs/syntax_and_semantics/next.html

It might be helpful to note that next can take a parameter, which will then be the value of that next statement (the same way return does). This is useful to know when writing a code block for something.reduce{}, for instance, where it's probably important that the code block not return a nil.

Hmm. Is this also true for the break statement?

@Sija
Copy link
Contributor

Sija commented May 1, 2017

Hmm. Is this also true for the break statement?

AFAIK yes.

See https://play.crystal-lang.org/#/r/1yic

@mverzilli
Copy link

Thanks @drosehn! We've got a specific repo for these issues (see above). Please next time open it there. I just opened an issue referencing this on crystal-lang/crystal-book#97.

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

No branches or pull requests

3 participants