repeat with each woord currentWord in myString

Brian Yennie briany at qldlearning.com
Sat Mar 20 16:24:56 EST 2004


> I don't know (yet) how fast the script interpreter is with (large) 
> arrays, but a common way of handling large numbers of "chunks" like 
> this is to put them into an array, if you really need to "reuse" them 
> or access them randomly:
>
> put 1 into counter
> repeat for each word someWord in someVariable
> put someWord into wordarray[counter]
> increment counter by 1 # don't know if Transcript can do this,
> # the proper way would be to say "counter++", naturally
> end repeat

Yup, this is good advice if you need to save the chunks, or make more 
than one pass through.
The transcript for incrementing is "add 1 to counter", which is 
equivalent to other languages'  "counter++".
Of course you can also say "put counter + 1 into counter" , which is 
equivalent to "counter = counter + 1" or "counter += 1"

- Brian



More information about the use-livecode mailing list