rescript-lang / rescript-lang/rescript-lang.org
Possible addition to discussion of loops
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 1.9k
- Forks
- 260
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 17
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the control-flow documentation at the linked for-loops section and review how loop-body expressions are currently described. Confirm the shown example and error behavior, then document that the body must evaluate to unit, including the ignore workaround; the section should explain the requirement clearly to readers.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100