Skip to content

Commit 6df8ca2

Browse files
authored
arrays: fix examples for find_first and find_last (#19153)
1 parent d0e6057 commit 6df8ca2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vlib/arrays/arrays.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ pub fn carray_to_varray[T](c_array_data voidptr, items int) []T {
681681

682682
// find_first returns the first element that matches the given predicate
683683
// returns `none`, if there is no match found
684-
// Example: arrays.find_first([1, 2, 3, 4, 5], fn (arr int) bool { arr == 3}) // => 3
684+
// Example: arrays.find_first([1, 2, 3, 4, 5], fn (i int) bool { return i == 3 })? // => 3
685685
pub fn find_first[T](array []T, predicate fn (elem T) bool) ?T {
686686
if array.len == 0 {
687687
return none
@@ -696,7 +696,7 @@ pub fn find_first[T](array []T, predicate fn (elem T) bool) ?T {
696696

697697
// find_last returns the last element that matches the given predicate
698698
// returns `none`, if there is no match found
699-
// Example: arrays.find_last([1, 2, 3, 4, 5], fn (arr int) bool { arr == 3}) // => 3
699+
// Example: arrays.find_last([1, 2, 3, 4, 5], fn (i int) bool { return i == 3})? // => 3
700700
pub fn find_last[T](array []T, predicate fn (elem T) bool) ?T {
701701
if array.len == 0 {
702702
return none

0 commit comments

Comments
 (0)