On Tuesday 13 March 2007 11:38, noreply / rubyforge.org wrote: > Summary: "each" function failed to detect element delete then jump a valid element when next yield. > > Initial Comment: > "each" function failed to detect element delete then jump a valid element when next yield. > > ----sample code---- > a=[1,2,3] > a.each do |b| > a.delete b if b==1 > puts b > end > ---- Ah, the typical "how should the system behave if I delete something from the array I'm currently iterating over" issue... always a fun discussion in almost every language I've seen so far. Many simply throw an exception on the next iteration or something like that. Just Don't Do That :-) There is no such things as The Right Behaviour in this case, only behaviours that some people think are less wrong than other behaviours. Marc -- Marc Haisenko Comdasys AG R¥Æ¥·desheimer Stra¥ÆÝÆ 7 D-80686 München Tel: +49 (0)89 - 548 43 33 21 Fax: +49 (0)89 - 548 43 33 29 e-mail: haisenko / comdasys.com http://www.comdasys.com