drop(p1)
public
Drops first n elements from ary
and returns the rest of the elements in an array.
a = [1, 2, 3, 4, 5, 0]
a.drop(3)
Show source
static VALUE
rb_ary_drop(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_LEN(ary));
if (result == Qnil) result = rb_ary_new();
return result;
}