drop(p1)
public
Drops first n elements from ary,
and returns rest elements in an array.
a = [1, 2, 3, 4, 5, 0]
a.drop(3)
Show source
/*
* call-seq:
* ary.drop(n) => array
*
* Drops first n elements from <i>ary</i>, and returns rest elements
* in an array.
*
* a = [1, 2, 3, 4, 5, 0]
* a.drop(3)
*
*/
static VALUE
rb_ary_drop(ary, n)
VALUE ary;
VALUE n;
{
VALUE result;
long pos = NUM2LONG(n);
if (pos < 0) {
rb_raise(rb_eArgError, "attempt to drop negative size");
}
result = rb_ary_subseq(ary, pos, RARRAY(ary)->len);
if (result == Qnil) result = rb_ary_new();
return result;
}