[DOC] Tweaks for Array#take (#11929)
This commit is contained in:
parent
b41c65b577
commit
c837ae85d8
Notes:
git
2024-10-22 16:35:28 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>
22
array.c
22
array.c
@ -7481,20 +7481,20 @@ done:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* array.take(n) -> new_array
|
* take(count) -> new_array
|
||||||
*
|
*
|
||||||
* Returns a new +Array+ containing the first +n+ element of +self+,
|
* Returns a new array containing the first +count+ element of +self+
|
||||||
* where +n+ is a non-negative Integer;
|
* (as available);
|
||||||
* does not modify +self+.
|
* +count+ must be a non-negative numeric;
|
||||||
|
* does not modify +self+:
|
||||||
*
|
*
|
||||||
* Examples:
|
* a = ['a', 'b', 'c', 'd']
|
||||||
*
|
* a.take(2) # => ["a", "b"]
|
||||||
* a = [0, 1, 2, 3, 4, 5]
|
* a.take(2.1) # => ["a", "b"]
|
||||||
* a.take(1) # => [0]
|
* a.take(50) # => ["a", "b", "c", "d"]
|
||||||
* a.take(2) # => [0, 1]
|
* a.take(0) # => []
|
||||||
* a.take(50) # => [0, 1, 2, 3, 4, 5]
|
|
||||||
* a # => [0, 1, 2, 3, 4, 5]
|
|
||||||
*
|
*
|
||||||
|
* Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user