Skip to content

Commit 01cc6cd

Browse files
authored
Merge pull request #317 from kevanstannard/syntax-lookup-module
Syntax lookup: Module
2 parents b1ecde6 + abdb1e6 commit 01cc6cd

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

misc_docs/syntax/language_module.mdx

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
id: "module"
3+
keywords: ["module"]
4+
name: "module"
5+
summary: "This is the `module` keyword."
6+
category: "languageconstructs"
7+
---
8+
9+
`module` is used to define a scoped block of code that may contain types, `let` bindings, nested modules, etc.
10+
11+
### Example
12+
13+
<CodeTab labels={["ReScript", "JS Output"]}>
14+
15+
```res
16+
module Point3D = {
17+
type point = (float, float, float)
18+
let make = (x, y, z) => (x, y, z)
19+
}
20+
21+
let origin = Point3D.make(0.0, 0.0, 0.0)
22+
```
23+
24+
```js
25+
function make(x, y, z) {
26+
return [x, y, z];
27+
}
28+
29+
var Point3D = {
30+
make: make,
31+
};
32+
33+
var origin = [0.0, 0.0, 0.0];
34+
```
35+
36+
</CodeTab>
37+
38+
### References
39+
40+
* [Module](/docs/manual/latest/module)

0 commit comments

Comments
 (0)