@@ -19,15 +19,15 @@ Integer literals may contain digit separators to allow digit grouping into more
19
19
20
20
Example:
21
21
22
- ```
22
+ ``` js
23
23
10_000_000_000
24
24
```
25
25
26
26
## Fields
27
27
28
28
Struct fields and map elements can be accessed by using the ` . ` or the ` [] ` syntax.
29
29
30
- ```
30
+ ``` js
31
31
foo .Field
32
32
bar[" some-key" ]
33
33
```
@@ -36,7 +36,7 @@ bar["some-key"]
36
36
37
37
Functions may be called using the ` () ` syntax.
38
38
39
- ```
39
+ ``` js
40
40
foo .Method ()
41
41
```
42
42
@@ -53,7 +53,7 @@ foo.Method()
53
53
54
54
Example:
55
55
56
- ```
56
+ ``` js
57
57
x^ 2 + y^ 2
58
58
```
59
59
@@ -74,7 +74,7 @@ x^2 + y^2
74
74
75
75
Example:
76
76
77
- ```
77
+ ``` js
78
78
life < universe || life < everything
79
79
```
80
80
@@ -88,7 +88,7 @@ life < universe || life < everything
88
88
89
89
Example:
90
90
91
- ```
91
+ ``` js
92
92
" hello" matches " h.*"
93
93
```
94
94
@@ -99,11 +99,11 @@ Example:
99
99
100
100
Example:
101
101
102
- ```
102
+ ``` js
103
103
user .Group in [" human_resources" , " marketing" ]
104
104
```
105
105
106
- ```
106
+ ``` js
107
107
" foo" in {foo: 1 , bar: 2 }
108
108
```
109
109
@@ -113,13 +113,13 @@ user.Group in ["human_resources", "marketing"]
113
113
114
114
Example:
115
115
116
- ```
116
+ ``` js
117
117
user .Age in 18..45
118
118
```
119
119
120
120
The range is inclusive:
121
121
122
- ```
122
+ ``` js
123
123
1..3 == [1 , 2 , 3 ]
124
124
```
125
125
@@ -129,7 +129,7 @@ The range is inclusive:
129
129
130
130
Example:
131
131
132
- ```
132
+ ``` js
133
133
user .Age > 30 ? " mature" : " immature"
134
134
```
135
135
@@ -157,7 +157,7 @@ user.Age > 30 ? "mature" : "immature"
157
157
158
158
Returns ** true** if all elements satisfies the predicate (or if the array is empty).
159
159
160
- ```
160
+ ``` js
161
161
all (Tweets, {.Size < 280 })
162
162
```
163
163
@@ -170,7 +170,7 @@ Returns **true** if any elements satisfies the predicate. If the array is empty,
170
170
171
171
Returns ** true** if _ exactly one_ element satisfies the predicate. If the array is empty, returns ** false** .
172
172
173
- ```
173
+ ``` js
174
174
one (Participants, {.Winner })
175
175
```
176
176
@@ -194,7 +194,7 @@ Returns new array by filtering elements of the array by predicate.
194
194
195
195
Returns the number of elements what satisfies the predicate. Equivalent to:
196
196
197
- ```
197
+ ``` js
198
198
len (filter (array, predicate))
199
199
```
200
200
@@ -203,14 +203,14 @@ len(filter(array, predicate))
203
203
The closure is an expression that accepts a single argument. To access
204
204
the argument use the ` # ` symbol.
205
205
206
- ```
206
+ ``` js
207
207
map (0..9 , {# / 2 })
208
208
```
209
209
210
210
If the item of array is struct, it is possible to access fields of struct with
211
211
omitted ` # ` symbol (` #.Value ` becomes ` .Value ` ).
212
212
213
- ```
213
+ ``` js
214
214
filter (Tweets, {len (.Value ) > 280 })
215
215
```
216
216
@@ -224,7 +224,7 @@ Example:
224
224
225
225
Variable ` array ` is ` [1,2,3,4,5] ` .
226
226
227
- ```
227
+ ``` js
228
228
array[1 : 4 ] == [2 ,3 ,4 ]
229
229
array[: 3 ] == [1 ,2 ,3 ]
230
230
array[3 : ] == [4 ,5 ]
0 commit comments