-
-
Notifications
You must be signed in to change notification settings - Fork 248
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 #165 from kevanstannard/syntax-widget-basic-operators
Add basic operators to the syntax widget
- Loading branch information
Showing
11 changed files
with
438 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,23 @@ | ||
--- | ||
id: "float-addition" | ||
keywords: ["plus", "add", "addition", "sum", "float"] | ||
name: "+." | ||
summary: "This is the `floating point addition` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *floating point* addition. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 1.3 +. 0.5 | ||
``` | ||
|
||
```js | ||
var result = 1.3 + 0.5; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For adding *integers* see the `+` operator. |
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,23 @@ | ||
--- | ||
id: "float-division" | ||
keywords: ["divide", "division", "float"] | ||
name: "/." | ||
summary: "This is the `floating point division` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *floating point* division. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 3.0 /. 2.5 | ||
``` | ||
|
||
```js | ||
var result = 3.0 / 2.5; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For dividing *integers* see the `/` operator. |
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,23 @@ | ||
--- | ||
id: "float-multiplication" | ||
keywords: ["multiply", "multiplication", "float"] | ||
name: "*." | ||
summary: "This is the `floating point multiplication` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *floating point* multiplication. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 1.5 *. 2.3 | ||
``` | ||
|
||
```js | ||
var result = 1.5 * 2.3; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For multiplying *integers* see the `*` operator. |
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,23 @@ | ||
--- | ||
id: "float-subtraction" | ||
keywords: ["subtract", "minus", "subtraction", "float"] | ||
name: "-." | ||
summary: "This is the `floating point subtraction` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *floating point* subtraction. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 3.0 -. 2.5 | ||
``` | ||
|
||
```js | ||
var result = 3.0 - 2.5; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For subtracting *integers* see the `-` operator. |
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,25 @@ | ||
--- | ||
id: "integer-addition" | ||
keywords: ["plus", "add", "addition", "sum", "int", "integer"] | ||
name: "+" | ||
summary: "This is the `integer addition` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *integers* addition. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 1 + 2 | ||
``` | ||
|
||
```js | ||
val result = 3; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For adding *floats* see the `+.` operator. | ||
|
||
For contatenating *strings* see the `++` operator. |
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,25 @@ | ||
--- | ||
id: "integer-division" | ||
keywords: ["divide", "division", "int", "integer"] | ||
name: "/" | ||
summary: "This is the `integer division` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *integer* division, with the result truncated to an integer value. | ||
|
||
If the second argument is *zero* then a `Division_by_zero` exception is thrown. Refer to the [Exception](/docs/manual/latest/exception) section for handling exceptions. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 3 / 2 | ||
``` | ||
|
||
```js | ||
var result = 1; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For dividing *floats* see the `/.` operator. |
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,23 @@ | ||
--- | ||
id: "integer-multiplication" | ||
keywords: ["multiply", "multiplication", "int", "integer"] | ||
name: "*" | ||
summary: "This is the `integer multiplication` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *integer* multiplication. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 2 * 3 | ||
``` | ||
|
||
```js | ||
var result = 6; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For multiplying *floats* see the `*.` operator. |
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,23 @@ | ||
--- | ||
id: "integer-subtraction" | ||
keywords: ["subtract", "minus", "subtraction", "int", "integer"] | ||
name: "-" | ||
summary: "This is the `integer subtraction` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator performs *integer* subtraction. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let result = 3 - 2 | ||
``` | ||
|
||
```js | ||
var result = 1; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
For subtracting *floats* see the `-.` operator. |
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,23 @@ | ||
--- | ||
id: "string-concatenation" | ||
keywords: ["concat", "concatenation", "add", "string"] | ||
name: "++" | ||
summary: "This is the `string concatenation` operator." | ||
category: "operators" | ||
--- | ||
|
||
This operator concatenates two *strings* together. | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let greetings = "Hello " ++ "world!" | ||
``` | ||
|
||
```js | ||
var greetings = "Hello world!"; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.