116
116
117
117
Examples:
118
118
119
- ``` python
119
+ ``` c++
120
120
user.Age in 18 ..45 and user.Name not in [" admin" , " root" ]
121
121
```
122
122
123
- ``` python
123
+ ``` c++
124
124
foo matches " ^[A-Z].*"
125
125
```
126
126
@@ -143,7 +143,7 @@ The `?.` operator can be used to access a field of a struct or an item of a map
143
143
without checking if the struct or the map is ` nil ` . If the struct or the map is
144
144
` nil ` , the result of the expression is ` nil ` .
145
145
146
- ``` python
146
+ ``` c++
147
147
author?.User?.Name
148
148
```
149
149
@@ -153,7 +153,7 @@ The slice operator `[:]` can be used to access a slice of an array.
153
153
154
154
For example, variable ` array ` is ` [1, 2, 3, 4, 5] ` :
155
155
156
- ``` python
156
+ ``` c++
157
157
array[1 :4 ] == [2 , 3 , 4 ]
158
158
array[1 :-1 ] == [2 , 3 , 4 ]
159
159
array[:3 ] == [1 , 2 , 3 ]
@@ -191,7 +191,7 @@ array[:] == array
191
191
Returns ** true** if all elements satisfies the [ predicate] ( #predicate ) .
192
192
If the array is empty, returns ** true** .
193
193
194
- ``` python
194
+ ``` c++
195
195
all (Tweets, {.Size < 280})
196
196
```
197
197
@@ -205,7 +205,7 @@ If the array is empty, returns **false**.
205
205
Returns **true** if _exactly one_ element satisfies the [predicate](#predicate).
206
206
If the array is empty, returns **false**.
207
207
208
- ``` python
208
+ ```c++
209
209
one(Participants, {.Winner})
210
210
```
211
211
@@ -228,7 +228,7 @@ Returns new array by filtering elements of the array by [predicate](#predicate).
228
228
Returns the number of elements what satisfies the [ predicate] ( #predicate ) .
229
229
Equivalent to:
230
230
231
- ``` python
231
+ ``` c++
232
232
len (filter(array, predicate))
233
233
```
234
234
@@ -244,7 +244,7 @@ Returns the absolute value of a number.
244
244
245
245
Returns the integer value of a number or a string.
246
246
247
- ``` python
247
+ ```c++
248
248
int("123") == 123
249
249
```
250
250
@@ -264,12 +264,12 @@ map(0..9, {# / 2})
264
264
If items of the array is a struct or a map, it is possible to access fields with
265
265
omitted `#` symbol (`#.Value` becomes `.Value`).
266
266
267
- ```python
267
+ ```c++
268
268
filter(Tweets, {len(.Value) > 280})
269
269
```
270
270
271
271
Braces ` { ` ` } ` can be omitted:
272
272
273
- ``` python
273
+ ``` c++
274
274
filter (Tweets, len(.Value) > 280)
275
275
```
0 commit comments