How to use an array to solve the following...

Geoff Canyon Rev gcanyon+rev at gmail.com
Tue Feb 21 10:16:47 EST 2012


On Tue, Feb 21, 2012 at 3:52 AM, Kay C Lan <lan.kc.macmail at gmail.com> wrote:

>  repeat for each line L in the keys of yourArray
>       if L > 20 then
>          put L & cr after R
>          if L > 60 then
>                exit repeat
>         end if
>      end if
>  end repeat
>
> Don't waste cyling through lines you don't have to.
>

Agreed, if the keys are sorted. I was assuming that they were coming
straight from the keys of the array (as shown in my example) so you'd have
to test the whole thing. I'd be curious which is faster:

get the keys
sort the keys
do your script

or

get the keys
do my script

My first instinct is to say your solution, for the obvious reasons, but
I've been fooled by the near-infinite speed of repeat for each too many
times to count.



More information about the use-livecode mailing list