repeat with each

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Sep 22 10:16:51 EDT 2014


Hi Paul,

I should have read it one more time before posting. This should be the 
correct script:

repeat for each word myWord in field "Just One"
   put myWord & comma after myNewdata
end repeat
delete last char of myNewData
sort items of myNewData
put myNewData into field "Just One"

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 9/22/2014 15:28, Paul Foraker wrote:
> On Mon, Sep 22, 2014 at 6:13 AM, Mark Schonewille <
> m.schonewille at economy-x-talk.com> wrote:
>
>> repeat for each word myWord in field "Just One"
>>    put thisWord & comma after myNewdata
>> end repeat
>> sort items of myNewData
>> put char 1 to -2 of myNewData into field "Just One"
>>
>
> This loop generates a string that (1) starts with an empty item and (2)
> repeats the word "thisWord", deleting the last "d".
>
> (1) The last item after the loop finishes is empty -- the comma at the end.
> After the sort, however, that comma is at the front of the variable.
>
> A simple solution would be to replace the last line with
>
> put char 2 to -1 of myNewData into fld "Just One"
>
> (2) Instead of "put thisWord", it should be "put myWord".  Or, "repeat for
> each word thisWord"
>
> -- Paul





More information about the use-livecode mailing list