Skip to content

Commit

Permalink
Merge pull request #317 from kevanstannard/syntax-lookup-module
Browse files Browse the repository at this point in the history
Syntax lookup: Module
  • Loading branch information
ryyppy authored May 5, 2021
2 parents b1ecde6 + abdb1e6 commit 01cc6cd
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions misc_docs/syntax/language_module.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
id: "module"
keywords: ["module"]
name: "module"
summary: "This is the `module` keyword."
category: "languageconstructs"
---

`module` is used to define a scoped block of code that may contain types, `let` bindings, nested modules, etc.

### Example

<CodeTab labels={["ReScript", "JS Output"]}>

```res
module Point3D = {
type point = (float, float, float)
let make = (x, y, z) => (x, y, z)
}
let origin = Point3D.make(0.0, 0.0, 0.0)
```

```js
function make(x, y, z) {
return [x, y, z];
}

var Point3D = {
make: make,
};

var origin = [0.0, 0.0, 0.0];
```

</CodeTab>

### References

* [Module](/docs/manual/latest/module)

0 comments on commit 01cc6cd

Please sign in to comment.