-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from kevanstannard/syntax-lookup-module
Syntax lookup: Module
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |