[DOC] Tweaks for Array#take (#11929)

This commit is contained in:
Burdette Lamar 2024-10-22 11:35:09 -05:00 committed by GitHub
parent b41c65b577
commit c837ae85d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2024-10-22 16:35:28 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>

22
array.c
View File

@ -7481,20 +7481,20 @@ done:
/*
* 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+.
* Returns a new array containing the first +count+ element of +self+
* (as available);
* +count+ must be a non-negative numeric;
* does not modify +self+:
*
* Examples:
*
* 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