diff options
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -715,12 +715,16 @@ rb_ary_at(ary, pos) /* * call-seq: * array.first -> obj or nil - * - * Returns the first element of the array. If the array is empty, - * returns <code>nil</code>. - * + * array.first(n) -> an_array + * + * Returns the first element, or the first +n+ elements, of the array. + * If the array is empty, the first form returns <code>nil</code>, and the + * second form returns an empty array. + * * a = [ "q", "r", "s", "t" ] - * a.first #=> "q" + * a.first #=> "q" + * a.first(1) #=> ["q"] + * a.first(3) #=> ["q", "r", "s"] */ static VALUE |