Method: Array#delete_if
- Defined in:
- array.c
#delete_if {|item| ... } ⇒ Array #delete_if ⇒ Enumerator
Deletes every element of self for which block evaluates to true.
The array is changed instantly every time the block is called, not after the iteration is over.
See also Array#reject!
If no block is given, an Enumerator is returned instead.
scores = [ 97, 42, 75 ]
scores.delete_if {|score| score < 80 } #=> [97]
3263 3264 3265 3266 3267 3268 3269 |
# File 'array.c', line 3263
static VALUE
rb_ary_delete_if(VALUE ary)
{
RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
ary_reject_bang(ary);
return ary;
}
|