Skip to content

Commit 76cf095

Browse files
authored
Update Language-Definition.md
1 parent 6070193 commit 76cf095

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

docs/Language-Definition.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Integer literals may contain digit separators to allow digit grouping into more
1919

2020
Example:
2121

22-
```
22+
```js
2323
10_000_000_000
2424
```
2525

2626
## Fields
2727

2828
Struct fields and map elements can be accessed by using the `.` or the `[]` syntax.
2929

30-
```
30+
```js
3131
foo.Field
3232
bar["some-key"]
3333
```
@@ -36,7 +36,7 @@ bar["some-key"]
3636

3737
Functions may be called using the `()` syntax.
3838

39-
```
39+
```js
4040
foo.Method()
4141
```
4242

@@ -53,7 +53,7 @@ foo.Method()
5353

5454
Example:
5555

56-
```
56+
```js
5757
x^2 + y^2
5858
```
5959

@@ -74,7 +74,7 @@ x^2 + y^2
7474

7575
Example:
7676

77-
```
77+
```js
7878
life < universe || life < everything
7979
```
8080

@@ -88,7 +88,7 @@ life < universe || life < everything
8888

8989
Example:
9090

91-
```
91+
```js
9292
"hello" matches "h.*"
9393
```
9494

@@ -99,11 +99,11 @@ Example:
9999

100100
Example:
101101

102-
```
102+
```js
103103
user.Group in ["human_resources", "marketing"]
104104
```
105105

106-
```
106+
```js
107107
"foo" in {foo: 1, bar: 2}
108108
```
109109

@@ -113,13 +113,13 @@ user.Group in ["human_resources", "marketing"]
113113

114114
Example:
115115

116-
```
116+
```js
117117
user.Age in 18..45
118118
```
119119

120120
The range is inclusive:
121121

122-
```
122+
```js
123123
1..3 == [1, 2, 3]
124124
```
125125

@@ -129,7 +129,7 @@ The range is inclusive:
129129

130130
Example:
131131

132-
```
132+
```js
133133
user.Age > 30 ? "mature" : "immature"
134134
```
135135

@@ -157,7 +157,7 @@ user.Age > 30 ? "mature" : "immature"
157157

158158
Returns **true** if all elements satisfies the predicate (or if the array is empty).
159159

160-
```
160+
```js
161161
all(Tweets, {.Size < 280})
162162
```
163163

@@ -170,7 +170,7 @@ Returns **true** if any elements satisfies the predicate. If the array is empty,
170170

171171
Returns **true** if _exactly one_ element satisfies the predicate. If the array is empty, returns **false**.
172172

173-
```
173+
```js
174174
one(Participants, {.Winner})
175175
```
176176

@@ -194,7 +194,7 @@ Returns new array by filtering elements of the array by predicate.
194194

195195
Returns the number of elements what satisfies the predicate. Equivalent to:
196196

197-
```
197+
```js
198198
len(filter(array, predicate))
199199
```
200200

@@ -203,14 +203,14 @@ len(filter(array, predicate))
203203
The closure is an expression that accepts a single argument. To access
204204
the argument use the `#` symbol.
205205

206-
```
206+
```js
207207
map(0..9, {# / 2})
208208
```
209209

210210
If the item of array is struct, it is possible to access fields of struct with
211211
omitted `#` symbol (`#.Value` becomes `.Value`).
212212

213-
```
213+
```js
214214
filter(Tweets, {len(.Value) > 280})
215215
```
216216

@@ -224,7 +224,7 @@ Example:
224224

225225
Variable `array` is `[1,2,3,4,5]`.
226226

227-
```
227+
```js
228228
array[1:4] == [2,3,4]
229229
array[:3] == [1,2,3]
230230
array[3:] == [4,5]

0 commit comments

Comments
 (0)