Skip to content

Commit

Permalink
[DOC] Tweaks for Array#take (ruby#11929)
Browse files Browse the repository at this point in the history
  • Loading branch information
BurdetteLamar authored Oct 22, 2024
1 parent b41c65b commit c837ae8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -7481,20 +7481,20 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)

/*
* call-seq:
* array.take(n) -> new_array
* take(count) -> new_array
*
* Returns a new +Array+ containing the first +n+ element of +self+,
* where +n+ is a non-negative Integer;
* does not modify +self+.
*
* Examples:
* Returns a new array containing the first +count+ element of +self+
* (as available);
* +count+ must be a non-negative numeric;
* does not modify +self+:
*
* a = [0, 1, 2, 3, 4, 5]
* a.take(1) # => [0]
* a.take(2) # => [0, 1]
* a.take(50) # => [0, 1, 2, 3, 4, 5]
* a # => [0, 1, 2, 3, 4, 5]
* a = ['a', 'b', 'c', 'd']
* a.take(2) # => ["a", "b"]
* a.take(2.1) # => ["a", "b"]
* a.take(50) # => ["a", "b", "c", "d"]
* a.take(0) # => []
*
* Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/

static VALUE
Expand Down

0 comments on commit c837ae8

Please sign in to comment.