Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic operators to the syntax widget #165

Merged
merged 2 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions misc_docs/syntax/operators_float_addition.mdx
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.
23 changes: 23 additions & 0 deletions misc_docs/syntax/operators_float_division.mdx
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.
23 changes: 23 additions & 0 deletions misc_docs/syntax/operators_float_multiplication.mdx
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.
23 changes: 23 additions & 0 deletions misc_docs/syntax/operators_float_subtraction.mdx
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.
25 changes: 25 additions & 0 deletions misc_docs/syntax/operators_integer_addition.mdx
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.
25 changes: 25 additions & 0 deletions misc_docs/syntax/operators_integer_division.mdx
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.
23 changes: 23 additions & 0 deletions misc_docs/syntax/operators_integer_multiplication.mdx
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.
23 changes: 23 additions & 0 deletions misc_docs/syntax/operators_integer_subtraction.mdx
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.
23 changes: 23 additions & 0 deletions misc_docs/syntax/operators_string_concatenation.mdx
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>


128 changes: 128 additions & 0 deletions src/components/SyntaxLookupWidget.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading