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

Possible addition to discussion of loops #460

Open
jdeisenberg opened this issue Nov 15, 2021 · 1 comment
Open

Possible addition to discussion of loops #460

jdeisenberg opened this issue Nov 15, 2021 · 1 comment

Comments

@jdeisenberg
Copy link
Contributor

Regarding https://rescript-lang.org/docs/manual/latest/control-flow#for-loops
It appears that the body of a for loop must evaluate to unit. This code:

let n: array<int> = []
for i in 1 to 3 {
  Js.Array2.push(n, i)
}

produces this error (the fix is to pipe to ignore):

[E] Line 3, column 2:

This has type: int
  Somewhere wanted: unit

Is this worth documenting?

@ryyppy
Copy link
Member

ryyppy commented Jan 19, 2022

Yeah that might be worth to be added

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

2 participants