From: Robert Klemme Date: 2004-11-11T23:48:29+09:00 Subject: Re: array.each restart when array is changed "David A. Black" schrieb im Newsbeitrag news:Pine.LNX.4.44.0411110542180.12257-100000@wobblini... > Hi -- > > On Thu, 11 Nov 2004, Robert Klemme wrote: > > > > > "Kevin B�rgens" schrieb im Newsbeitrag > > news:2vfjurF2ljhdfU1@uni-berlin.de... > > > Hi! > > > > > > > > > How to restart a "each" iteration when the iterated array is changed? I > > do > > > it like this > > > > > > changed=false > > > while (changed) > > > changed=false > > > array.each {|e| > > > if (today_is_christmas) > > > array=array+=["Hello santa claus"] > > > > This is sufficient: > > array += +=["Hello santa claus"] > > Do you mean array += ["Hello santa clause"] ? Well, you will have to patch the Ruby parser - but then it's sufficient. :-)) Of course I meant to put only one "+=" there. :-) "a = a += x" is one assignment too much. > (See my earlier > response -- actually, don't, because except for that, it probably > wasn't very good :-) Um, which one? I can't see another post of you in this thread. Weired... robert