diff options
| author | Étienne Barrié <etienne.barrie@gmail.com> | 2025-12-15 14:47:54 +0100 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-12-17 21:22:39 -0800 |
| commit | 769c6a1c54e68d0100054e51fc25e1a6355645c8 (patch) | |
| tree | 5219ce63ca349a5070cbba4c7eedbd9c984d5e7a /array.c | |
| parent | b816f7bac5f2dfb10c7a468c14cfcdedaab2f7ae (diff) | |
[DOC] Use Arrays in examples for Array#find
Diffstat (limited to 'array.c')
| -rw-r--r-- | array.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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. * |
