@@ -10,47 +10,47 @@ _Details: [Let Bindings](/let-bindings)_
10
10
11
11
Feature | Example
12
12
--------------------------------|----------
13
- String value | ` let hi = "Hello World"; `
14
- Int value | ` let count = 42; `
15
- Type annotation on binding | ` let count: int = 42; `
13
+ String value | < code class = " text-ocaml " > let hi = "Hello World"</ code >< code class = " text-reasonml " >let hi = "Hello World";</ code >
14
+ Int value | < code class = " text-ocaml " > let count = 42</ code >< code class = " text-reasonml " >let count = 42;</ code >
15
+ Type annotation on binding | < code class = " text-ocaml " > let count: int = 42</ code >< code class = " text-reasonml " >let count: int = 42;</ code >
16
16
17
17
- Note: Let bindings are immutable and cannot change once created.
18
18
19
19
## Built In Types
20
20
21
- _ Details: [ Primitives] ( primitives ) _
21
+ _ Details: [ Primitives] ( / primitives) _
22
22
23
23
Feature | Example
24
24
--------------------------------|----------
25
- Int | ` let x: int = 10; `
26
- Float | ` let x: float = 10.0; `
27
- Boolean | ` let x: bool = false; `
28
- String | ` let x: string = "ten"; `
29
- Char | ` let x: char = 'c'; `
30
- Unit | ` let x: unit = (); `
31
- Option | ` let x: option(int) = Some(10); `
32
- Tuple | ` let x: (int, string) = (10, "ten"); `
33
- List | ` let x: list(int) = [1, 2, 3]; `
34
- Array | <code >let x: array(int) = [ | ; 1, 2, 3| ; ] ;</code >
35
- Functions | ` let x: (int, int) => int = (a, b) => a + b; `
25
+ Int | < code class = " text-ocaml " > let x: int = 10</ code >< code class = " text-reasonml " >let x: int = 10;</ code >
26
+ Float | < code class = " text-ocaml " > let x: float = 10.0</ code >< code class = " text-reasonml " >let x: float = 10.0;</ code >
27
+ Boolean | < code class = " text-ocaml " > let x: bool = false</ code >< code class = " text-reasonml " >let x: bool = false;</ code >
28
+ String | < code class = " text-ocaml " > let x: string = "ten"</ code >< code class = " text-reasonml " >let x: string = "ten";</ code >
29
+ Char | < code class = " text-ocaml " > let x: char = 'c'</ code >< code class = " text-reasonml " >let x: char = 'c';</ code >
30
+ Unit | < code class = " text-ocaml " > let x: unit = ()</ code >< code class = " text-reasonml " >let x: unit = ();</ code >
31
+ Option | < code class = " text-ocaml " > let x: int option = Some 10</ code >< code class = " text-reasonml " >let x: option (int) = Some(10);</ code >
32
+ Tuple | < code class = " text-ocaml " > let x: (int, string) = (10, "ten")</ code >< code class = " text-reasonml " >let x: (int, string) = (10, "ten");</ code >
33
+ List | < code class = " text-ocaml " > let x: int list = [ 1; 2; 3 ] ;</ code >< code class = " text-reasonml " >let x: list (int) = [ 1, 2, 3] ;</ code >
34
+ Array | <code class = " text-ocaml " >let x: int array = [ &# 124 ; 1; 2; 3 &# 124 ; ] </ code >< code class = " text-reasonml " >let x: array(int) = [ | ; 1, 2, 3| ; ] ;</code >
35
+ Functions | < code class = " text-ocaml " > let x : int -> int -> int = fun a b -> a + b</ code >< code class = " text-reasonml " >let x: (int, int) => int = (a, b) => a + b;</ code >
36
36
37
37
## Strings
38
38
39
- _ Details: [ Strings] ( primitives#strings ) _
39
+ _ Details: [ Strings] ( / primitives#strings) _
40
40
41
41
Feature | Example
42
42
--------------------------------|----------
43
43
String | ` "Hello" `
44
- String concatenation | ` " Hello " ++ "World"`
44
+ String concatenation | < code class = " text-ocaml " >" Hello " ^ "World"</ code >< code class = " text-reasonml " >"Hello " ++ "World"</ code >
45
45
Character | ` 'x' `
46
- Character at index | ` let x = "Hello"; x.[2]; `
46
+ Character at index | < code class = " text-ocaml " > let x = "Hello" in x. [ 2 ] </ code >< code class = " text-reasonml " >let x = "Hello" ; x.[ 2] ;</ code >
47
47
48
- - String Functions: [ ` module String ` ] ( https://reasonml.github.io /api/String.html )
48
+ - String Functions: < a class = " text-ocaml " href = " https://melange.re/v4.0.0/api/ml/melange/Stdlib/String/ " > module String</ a >< a class = " text-reasonml " href = " https://melange.re/v4.0.0 /api/re/melange/Stdlib/ String/ " >module String</ a >
49
49
50
50
## Numbers
51
51
52
- - _ Details: [ Integer] ( primitives#integer ) _
53
- - _ Details: [ Float] ( primitives#float ) _
52
+ - _ Details: [ Integer] ( / primitives#integer) _
53
+ - _ Details: [ Float] ( / primitives#float) _
54
54
55
55
Feature | Example
56
56
--------------------------------|----------
@@ -63,29 +63,29 @@ Float exponentiation | `2.0 ** 3.0`
63
63
64
64
## Booleans and Logical Operators
65
65
66
- _ Details: [ Boolean] ( primitives#boolean ) _
66
+ _ Details: [ Boolean] ( / primitives#boolean) _
67
67
68
68
Feature | Example
69
69
--------------------------------|----------
70
70
Boolean Values | ` true ` , ` false `
71
71
Comparison | ` > ` , ` < ` , ` >= ` , ` <= `
72
- Boolean operations | ` ! ` , ` && ` , <code >| ;| ; </code >
73
- Reference equality | ` === ` , ` !== `
74
- Structural equality | ` == ` , ` != `
72
+ Boolean operations | < code class = " text-ocaml " >not</ code >< code class = " text-reasonml " >!</ code > , ` && ` , <code >| ;| ; </code >
73
+ Reference equality | < code class = " text-ocaml " >==</ code >< code class = " text-reasonml " >===</ code >, < code class = " text-ocaml " >!=</ code >< code class = " text-reasonml " >!==</ code >
74
+ Structural equality | < code class = " text-ocaml " >=</ code >< code class = " text-reasonml " >==</ code >, < code class = " text-ocaml " ><></ code >< code class = " text-reasonml " >!=</ code >
75
75
76
76
## If-Else Expressions
77
77
78
78
Feature | Example
79
79
--------------------------------|----------
80
- If-Else expressions | ` if (condition) { a; } else { b; } `
81
- Ternary expressions | ` condition ? a : b; `
80
+ If-Else expressions | < code class = " text-ocaml " > if condition then a else b</ code >< code class = " text-reasonml " >if (condition) { a; } else { b; }</ code >
81
+ Ternary expressions | < span class = " text-ocaml " >not applicable</ span >< code class = " text-reasonml " > condition ? a : b;</ code >
82
82
83
83
- Note: These are expressions and can be assigned to a variable:
84
- ` let x = if (condition) { a; } else { b; }; `
84
+ < code class = " text-ocaml " > let x = if condition then a else b</ code >< code class = " text-reasonml " >let x = if (condition) { a; } else { b; };</ code >
85
85
86
86
## Functions
87
87
88
- _ Details: [ Functions] ( functions ) _
88
+ _ Details: [ Functions] ( / functions) _
89
89
90
90
Feature | Example
91
91
--------------------------------|----------
0 commit comments