Counting problem

Peter Haworth pete at lcsql.com
Fri May 24 18:16:34 EDT 2013


On Fri, May 24, 2013 at 2:56 PM, <dunbarx at aol.com> wrote:

> I know I am going to feel like a dope, but why does the first script
> always properly give ten counts in the array variable "counter", but the
> second can give anywhere from five to sixteen, and maybe others?
>
>
>
> on mouseUp
>    put "a,b,c,d,e,f,g,h,i,j" into temp
>    repeat 10
>      get any item of temp --always gives ten
>       add 1 to counter[it]
>    end repeat
> end mouseUp
>
>
> on mouseup
>    put "a,b,c,d,e,f,g,h,i,j" into temp
>    repeat 10
>       add 1 to counter[any item of temp]
>   end repeat
> end mouseUp
>
>
>
>
> I have deconstructed the problem line by watching the array in the
> debugger on the sly after each iteration. It goes crazy, sometimes the
> count of a particular char going DOWN.
>

This isn't going to help, but the second script works just fine for me, the
total of the array key values always adds up to 10 as it does with the
first script.

LC 5.5.4 on OSX 10.7.4.

Pete
lcSQL Software <http://www.lcsql.com>



More information about the Use-livecode mailing list