116116
117117Examples:
118118
119- ``` python
119+ ``` c++
120120user.Age in 18 ..45 and user.Name not in [" admin" , " root" ]
121121```
122122
123- ``` python
123+ ``` c++
124124foo matches " ^[A-Z].*"
125125```
126126
@@ -143,7 +143,7 @@ The `?.` operator can be used to access a field of a struct or an item of a map
143143without checking if the struct or the map is ` nil ` . If the struct or the map is
144144` nil ` , the result of the expression is ` nil ` .
145145
146- ``` python
146+ ``` c++
147147author?.User?.Name
148148```
149149
@@ -153,7 +153,7 @@ The slice operator `[:]` can be used to access a slice of an array.
153153
154154For example, variable ` array ` is ` [1, 2, 3, 4, 5] ` :
155155
156- ``` python
156+ ``` c++
157157array[1 :4 ] == [2 , 3 , 4 ]
158158array[1 :-1 ] == [2 , 3 , 4 ]
159159array[:3 ] == [1 , 2 , 3 ]
@@ -191,7 +191,7 @@ array[:] == array
191191Returns ** true** if all elements satisfies the [ predicate] ( #predicate ) .
192192If the array is empty, returns ** true** .
193193
194- ``` python
194+ ``` c++
195195all (Tweets, {.Size < 280})
196196```
197197
@@ -205,7 +205,7 @@ If the array is empty, returns **false**.
205205Returns **true** if _exactly one_ element satisfies the [predicate](#predicate).
206206If the array is empty, returns **false**.
207207
208- ``` python
208+ ```c++
209209one(Participants, {.Winner})
210210```
211211
@@ -228,7 +228,7 @@ Returns new array by filtering elements of the array by [predicate](#predicate).
228228Returns the number of elements what satisfies the [ predicate] ( #predicate ) .
229229Equivalent to:
230230
231- ``` python
231+ ``` c++
232232len (filter(array, predicate))
233233```
234234
@@ -244,7 +244,7 @@ Returns the absolute value of a number.
244244
245245Returns the integer value of a number or a string.
246246
247- ``` python
247+ ```c++
248248int("123") == 123
249249```
250250
@@ -264,12 +264,12 @@ map(0..9, {# / 2})
264264If items of the array is a struct or a map, it is possible to access fields with
265265omitted `#` symbol (`#.Value` becomes `.Value`).
266266
267- ```python
267+ ```c++
268268filter(Tweets, {len(.Value) > 280})
269269```
270270
271271Braces ` { ` ` } ` can be omitted:
272272
273- ``` python
273+ ``` c++
274274filter (Tweets, len(.Value) > 280)
275275```
0 commit comments