File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22title : Syntax Cheatsheet
33---
44
5- We've worked very hard to make Reason look like JS while preserving OCaml's great semantics & types. Hope you enjoy it!
6-
7- ## Let Binding
5+ ## Variable
86
97| JavaScript | Reason |
108| ----------------------- | ------------------------------ |
119| ` const x = 5; ` | ` let x = 5; ` |
1210| ` var x = y; ` | No equivalent (thankfully) |
1311| ` let x = 5; x = x + 1; ` | ` let x = ref(5); x := x^ + 1; ` |
1412
15- ## String & Char
13+ ## String & Character
1614
1715| JavaScript | Reason |
1816| ---------------------- | --------------------- |
@@ -49,13 +47,11 @@ We've worked very hard to make Reason look like JS while preserving OCaml's grea
4947| JavaScript | Reason |
5048| ------------------- | --------------------------------------- |
5149| no static types | ` type point = {x: int, mutable y: int} ` |
52- | ` {x: 30, y: 20} ` | Same \* |
50+ | ` {x: 30, y: 20} ` | Same |
5351| ` point.x ` | Same |
5452| ` point.y = 30; ` | Same |
5553| ` {...point, x: 30} ` | Same |
5654
57- \* This is the Reason spiritual equivalent; it doesn't mean it compiles to JS' object! To compile to the latter, see [ here] ( object.md#tip-tricks ) .
58-
5955## Array
6056
6157| JavaScript | Reason |
You can’t perform that action at this time.
0 commit comments