Array.delete takes a block. : delete « Array « Ruby






Array.delete takes a block.


month_a = %w[ nil jan feb mar apr may jun jul aug sep oct nov dec ] 
month_a.delete("noon") {"noon wasn't found."}

 

Related examples in the same category

1.delete method removes a matching object from an array, returning the deleted object if found.