From 6df8ca212bd7952b996cf56279fec4814fa55bb5 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Thu, 17 Aug 2023 06:15:37 +0200 Subject: [PATCH] arrays: fix examples for `find_first` and `find_last` (#19153) --- vlib/arrays/arrays.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/arrays/arrays.v b/vlib/arrays/arrays.v index c729bc0be1..becd3b1733 100644 --- a/vlib/arrays/arrays.v +++ b/vlib/arrays/arrays.v @@ -681,7 +681,7 @@ pub fn carray_to_varray[T](c_array_data voidptr, items int) []T { // find_first returns the first element that matches the given predicate // returns `none`, if there is no match found -// Example: arrays.find_first([1, 2, 3, 4, 5], fn (arr int) bool { arr == 3}) // => 3 +// Example: arrays.find_first([1, 2, 3, 4, 5], fn (i int) bool { return i == 3 })? // => 3 pub fn find_first[T](array []T, predicate fn (elem T) bool) ?T { if array.len == 0 { return none @@ -696,7 +696,7 @@ pub fn find_first[T](array []T, predicate fn (elem T) bool) ?T { // find_last returns the last element that matches the given predicate // returns `none`, if there is no match found -// Example: arrays.find_last([1, 2, 3, 4, 5], fn (arr int) bool { arr == 3}) // => 3 +// Example: arrays.find_last([1, 2, 3, 4, 5], fn (i int) bool { return i == 3})? // => 3 pub fn find_last[T](array []T, predicate fn (elem T) bool) ?T { if array.len == 0 { return none