Skip to content

Commit 769c6a1

Browse files
etiennebarriejhawthorn
authored andcommitted
[DOC] Use Arrays in examples for Array#find
1 parent b816f7b commit 769c6a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

array.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,13 +2098,13 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
20982098
* With a block given, calls the block with successive elements of the array;
20992099
* returns the first element for which the block returns a truthy value:
21002100
*
2101-
* (0..9).find {|element| element > 2} # => 3
2101+
* [1, 3, 5].find {|element| element > 2} # => 3
21022102
*
21032103
* If no such element is found, calls +if_none_proc+ and returns its return value.
21042104
*
2105-
* (0..9).find(proc {false}) {|element| element > 12} # => false
2106-
* {foo: 0, bar: 1, baz: 2}.find {|key, value| key.start_with?('b') } # => [:bar, 1]
2107-
* {foo: 0, bar: 1, baz: 2}.find(proc {[]}) {|key, value| key.start_with?('c') } # => []
2105+
* [1, 3, 5].find(proc {false}) {|element| element > 12} # => false
2106+
* [[:foo, 0], [:bar, 1], [:baz, 2]].find {|key, value| key.start_with?('b') } # => [:bar, 1]
2107+
* [[:foo, 0], [:bar, 1], [:baz, 2]].find(proc {[]}) {|key, value| key.start_with?('c') } # => []
21082108
*
21092109
* With no block given, returns an Enumerator.
21102110
*

0 commit comments

Comments
 (0)