summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorÉtienne Barrié <etienne.barrie@gmail.com>2025-12-15 14:47:54 +0100
committerJohn Hawthorn <john@hawthorn.email>2025-12-17 21:22:39 -0800
commit769c6a1c54e68d0100054e51fc25e1a6355645c8 (patch)
tree5219ce63ca349a5070cbba4c7eedbd9c984d5e7a /array.c
parentb816f7bac5f2dfb10c7a468c14cfcdedaab2f7ae (diff)
[DOC] Use Arrays in examples for Array#find
Diffstat (limited to 'array.c')
-rw-r--r--array.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/array.c b/array.c
index b9d91d0a9b..27b84249bf 100644
--- a/array.c
+++ b/array.c
@@ -2098,13 +2098,13 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
* With a block given, calls the block with successive elements of the array;
* returns the first element for which the block returns a truthy value:
*
- * (0..9).find {|element| element > 2} # => 3
+ * [1, 3, 5].find {|element| element > 2} # => 3
*
* If no such element is found, calls +if_none_proc+ and returns its return value.
*
- * (0..9).find(proc {false}) {|element| element > 12} # => false
- * {foo: 0, bar: 1, baz: 2}.find {|key, value| key.start_with?('b') } # => [:bar, 1]
- * {foo: 0, bar: 1, baz: 2}.find(proc {[]}) {|key, value| key.start_with?('c') } # => []
+ * [1, 3, 5].find(proc {false}) {|element| element > 12} # => false
+ * [[:foo, 0], [:bar, 1], [:baz, 2]].find {|key, value| key.start_with?('b') } # => [:bar, 1]
+ * [[:foo, 0], [:bar, 1], [:baz, 2]].find(proc {[]}) {|key, value| key.start_with?('c') } # => []
*
* With no block given, returns an Enumerator.
*