Trans wrote: > How to remove the first occurrence of something? > > a=[1,2,3,4] > a.find!{ |e| a==2 } #=> 2 > > But there is no #find!, how to define it? My solutions seem unduly > complex. > > Thanks, > T. More complex than the following? arr = [1, 2, 3, 2, 2, 2] arr.each_with_index do |elmt, i| if elmt == 2 arr.delete_at(i) break end end p arr [1, 3, 2, 2, 2] -- Posted via http://www.ruby-forum.com/.