Certainly correct, but there is not the tremendous performance advantage to using "for each element in..." For items, lines, and words, using "item/line/word of myContainer" gets worse the larger the container is. For character and with arrays, it doesn't. In my quick testing here, there's just about no performance advantage to doing repeat for each element. There's about a 4x benefit for using "repeat for each char" over "repeat with i = 1 to length(myString)" But note that it seems to be 4x regardless of the string length. That isn't the case with items, lines, and words -- there, the longer your container, the more you'll suffer.
On Mon, Feb 20, 2012 at 3:02 PM, Bob Sneidar <b...@twft.com> wrote: > Also each element in <array> > > Bob > > > On Feb 20, 2012, at 10:34 AM, gcanyon+rev wrote: > > > any time you find yourself writing: > > > > repeat with i = 1 to the number of lines|words|items of someContainer > > > > stop. Rewrite it as: > > > > repeat for each line|word|item in someContainer > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode