Skip to content

Commit a2eb686

Browse files
authored
doc: document array .any() and .all() (#9386)
1 parent f9bbc11 commit a2eb686

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/docs.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,15 @@ println(upper_fn) // ['HELLO', 'WORLD']
713713

714714
`it` is a builtin variable which refers to element currently being processed in filter/map methods.
715715

716+
Additionally, `.any()` and `.all()` can be used to conveniently test
717+
for elements that satisfy a condition.
718+
719+
```v
720+
nums := [1, 2, 3]
721+
println(nums.any(it == 2)) // true
722+
println(nums.all(it >= 2)) // false
723+
```
724+
716725
#### Multidimensional Arrays
717726

718727
Arrays can have more than one dimension.

0 commit comments

Comments
 (0)