Hi Larry, Am 22.09.2014 um 15:04 schrieb la...@significantplanet.org:
> Hello, > > I have never been able to understand how to use the each form in a repeat > statement. > > Can anyone explain why this code does not work? It is almost verbatim from > the example in the LC dictionary. > > on mouseUp > repeat for each word thisWord in field justOne > put "," after thisWord > end repeat > sort items of field justOne > end mouseUp > > It does not insert the commas. Supposedly the each form is a lot faster than > using > > "put x + 1 into x" > "put "," after word x of field justOne "repeat for each XXXX..." is READ-ONLY! Means you cannot modify thisWord here! Collect your data in a variable first, then write stuff back to field: ... ## Never forget to put QUOTES around object names! repeat for each word thisWord in field "justOne" put thisWord & "," after tNewVariable end repeat delete char -1 of tNewVariable sort item of tNewVariable put tNewVariable into fld "justOne" ... > Thanks, > Larry Best Klaus -- Klaus Major http://www.major-k.de kl...@major-k.de _______________________________________________ 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