Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Deletes an element from self, per the given Integer index.
When index is non-negative, deletes the element at offset index:
a = [:foo, 'bar', 2]
a.delete_at(1) # => "bar"
a # => [:foo, 2]
If index is too large, returns nil.
When index is negative, counts backward from the end of the array:
a = [:foo, 'bar', 2]
a.delete_at(-2) # => "bar"
a # => [:foo, 2]
If index is too small (far from zero), returns nil.
               static VALUE
rb_ary_delete_at_m(VALUE ary, VALUE pos)
    return rb_ary_delete_at(ary, NUM2LONG(pos));

Was this page useful?