diff options
author | BurdetteLamar <[email protected]> | 2024-09-09 09:45:50 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-09-10 15:37:41 -0400 |
commit | 7ec51310d510ac8b46a7815e49bf8098a8957300 (patch) | |
tree | f9678fcb6360e65c7e26da7579bb4c7807d5fa16 /array.c | |
parent | a055a426ed146c55f4916f0c2d198bb9de109725 (diff) |
[DOC] Related for Array#cycle
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11577
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -6815,7 +6815,7 @@ rb_ary_cycle_size(VALUE self, VALUE args, VALUE eobj) * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects], * or +nil+. * - * If +count+ is positive, + * When +count+ is positive, * calls the block with each element, then does so repeatedly, * until it has done so +count+ times; returns +nil+: * @@ -6823,18 +6823,20 @@ rb_ary_cycle_size(VALUE self, VALUE args, VALUE eobj) * [0, 1].cycle(2) {|element| output.push(element) } # => nil * output # => [0, 1, 0, 1] * - * If +count+ is zero or negative, does not call the block: + * When +count+ is zero or negative, does not call the block: * * [0, 1].cycle(0) {|element| fail 'Cannot happen' } # => nil * [0, 1].cycle(-1) {|element| fail 'Cannot happen' } # => nil * - * If +count+ is +nil+, cycles forever: + * When +count+ is +nil+, cycles forever: * * # Prints 0 and 1 forever. * [0, 1].cycle {|element| puts element } * [0, 1].cycle(nil) {|element| puts element } * * With no block given, returns a new Enumerator. + * + * Related: see {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating]. */ static VALUE rb_ary_cycle(int argc, VALUE *argv, VALUE ary) |