Skip to content

Commit e7dae68

Browse files
authored
Merge pull request #223 from glor/patch-1
Clarify comparison with js
2 parents dcad394 + 830721c commit e7dae68

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

pages/docs/manual/latest/overview.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ canonical: "/docs/manual/latest/overview"
1111

1212
### Semicolon
1313

14-
| JavaScript | Us |
14+
| JavaScript | ReScript |
1515
| ------------------------------------ | -------------------- |
1616
| Rules enforced by linter/formatter | No semicolon needed! |
1717

1818
### Comments
1919

20-
| JavaScript | Us |
20+
| JavaScript | ReScript |
2121
| ----------------- | ----------- |
2222
| `/* Comment */` | Same |
2323
| `// Line comment` | Same |
2424

2525
### Variable
2626

27-
| JavaScript | Us |
27+
| JavaScript | ReScript |
2828
| ----------------------- | ------------------------------ |
2929
| `const x = 5;` | `let x = 5` |
3030
| `var x = y;` | No equivalent (thankfully) |
3131
| `let x = 5; x = x + 1;` | `let x = ref(5); x := x.contents + 1` |
3232

3333
### String & Character
3434

35-
| JavaScript | Us |
35+
| JavaScript | ReScript |
3636
| --------------------------| --------------------- |
3737
| `"Hello world!"` | Same |
3838
| `'Hello world!'` | Strings must use `"` |
@@ -41,7 +41,7 @@ canonical: "/docs/manual/latest/overview"
4141

4242
### Boolean
4343

44-
| JavaScript | Us |
44+
| JavaScript | ReScript |
4545
| ----------------------------------------------------- | ---------------------------------------------- |
4646
| `true`, `false` | Same |
4747
| `!true` | Same |
@@ -52,7 +52,7 @@ canonical: "/docs/manual/latest/overview"
5252

5353
### Number
5454

55-
| JavaScript | Us |
55+
| JavaScript | ReScript |
5656
| ----------- | ------------ |
5757
| `3` | Same \* |
5858
| `3.1415` | Same |
@@ -64,7 +64,7 @@ canonical: "/docs/manual/latest/overview"
6464

6565
### Object/Record
6666

67-
| JavaScript | Us |
67+
| JavaScript | ReScript |
6868
| ------------------- | --------------------------------------- |
6969
| no types | `type point = {x: int, mutable y: int}` |
7070
| `{x: 30, y: 20}` | Same |
@@ -74,7 +74,7 @@ canonical: "/docs/manual/latest/overview"
7474

7575
### Array
7676

77-
| JavaScript | Us |
77+
| JavaScript | ReScript |
7878
| --------------------- | ---------------------------------- |
7979
| `[1, 2, 3]` | Same |
8080
| `myArray[1] = 10` | Same |
@@ -84,15 +84,15 @@ canonical: "/docs/manual/latest/overview"
8484

8585
### Null
8686

87-
| JavaScript | Us |
87+
| JavaScript | ReScript |
8888
| ------------------- | --------- |
8989
| `null`, `undefined` | `None` \* |
9090

9191
\* Again, only a spiritual equivalent; we don't have nulls, nor null bugs! But we do have an `option` type for when you actually need nullability.
9292

9393
### Function
9494

95-
| JavaScript | Us |
95+
| JavaScript | ReScript |
9696
| ------------------------------- | ---------------------------- |
9797
| `arg => retVal` | Same |
9898
| `function named(arg) {...}` | `let named = (arg) => {...}` |
@@ -130,7 +130,7 @@ canonical: "/docs/manual/latest/overview"
130130

131131
### If-else
132132

133-
| JavaScript | Us |
133+
| JavaScript | ReScript |
134134
| --------------------- | ------------------------------------------------------------------- |
135135
| `if (a) {b} else {c}` | `if a {b} else {c}` \* |
136136
| `a ? b : c` | Same |
@@ -140,7 +140,7 @@ canonical: "/docs/manual/latest/overview"
140140

141141
### Destructuring
142142

143-
| JavaScript | Us |
143+
| JavaScript | ReScript |
144144
| ----------------------------- | --------------------------------------------- |
145145
| `const {a, b} = data` | `let {a, b} = data` |
146146
| `const [a, b] = data` | <code>let [a, b] = data</code> \* |
@@ -150,15 +150,15 @@ canonical: "/docs/manual/latest/overview"
150150

151151
### Loop
152152

153-
| JavaScript | Us |
153+
| JavaScript | ReScript |
154154
| ------------------------------------- | ------------------------------ |
155155
| `for (let i = 0; i <= 10; i++) {...}` | `for i in 0 to 10 {...}` |
156156
| `for (let i = 10; i >= 0; i--) {...}` | `for i in 10 downto 0 {...}` |
157157
| `while (true) {...}` | `while true {...}` |
158158

159159
### JSX
160160

161-
| JavaScript | Us |
161+
| JavaScript | ReScript |
162162
| ----------------------------------------- | -------------------------- |
163163
| `<Comp message="hi" onClick={handler} />` | Same |
164164
| `<Comp message={message} />` | `<Comp message />` \* |
@@ -169,7 +169,7 @@ canonical: "/docs/manual/latest/overview"
169169

170170
### Exception
171171

172-
| JavaScript | Us |
172+
| JavaScript | ReScript |
173173
| ----------------------------------------------- | ------------------------------------------ |
174174
| `throw new SomeError(...)` | `raise(SomeError(...))` |
175175
| `try {a} catch (Err) {...} finally {...}` | <code>try a catch { &#124; Err => ...}</code> \* |

0 commit comments

Comments
 (0)