Repeat Loop

DunbarX at aol.com DunbarX at aol.com
Fri Nov 20 16:22:24 EST 2009


Wierd.

The issue is whether or not 0 is in the range of the counter.

So going from -2 to -1 ( or 1 to 2 or 66 to 67 or -3 to -2) gives 11 
interations, as it should since the counter is inclusive.
But going from -1 to 1 (or -1 to 0 or 0 to -1) gives 12 interations, one 
extra.
It is consistently wrong; going from -1 to 1 gives 22 iterations, still one 
extra.

Bug? Bug.

Craig Newman



In a message dated 11/20/09 3:13:24 PM, jschwart at mitre.org writes:


> on mouseUp
>    repeat with n = 0 to 1 step 0.1
>       put n&"," after aList
>    end repeat
>    put aList
> end mouseUp
> 
> Returns
> 0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,
> 
> However,
> 
> on mouseUp
>    repeat with n = 0 to 2 step 0.1
>       put n&"," after aList
>    end repeat
>    put aList
> end mouseUp
> 
> Returns  
> 0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2,
> 




More information about the use-livecode mailing list