delete_if {|x| ... } -> self[permalink][rdoc][edit] reject! {|x| ... } -> self | nil delete_if -> Enumerator reject! -> Enumerator 要素を順番にブロックに渡して評価し、その結果が真になった要素をすべて削除します。 delete_if は常に self を返しますが、reject! は要素が 1 つ以上削除されれば self を、 1 つも削除されなければ nil を返します。 ブロックが与えられなかった場合は、自身と reject! から生成した Enumerator オブジェクトを返します。返された Enumerator オブジェクトの each メソッドには、もとの配列に対して副作用があることに注意してください。 例 a = [0, 1, 2, 3, 4,