Repeat Loop

Bill Marriott wjm at wjm.org
Sat Nov 21 06:19:50 EST 2009


Actually, to reveal the true issue, try this:

repeat with n = 0 to 1 step 0.1
put n & tab & (n - 1) * 100000000000 & return after aList
end repeat
put aList into fld 1

Rounding error. On the second-to-last iteration, Rev doesn't think it's 
quite reached "1" yet, so it goes through the loop one more time.

<DunbarX at aol.com> wrote in message 
news:d38.5da91e5a.38386412 at aol.com...
> Bug in last post;
>
> But going from -1 to 1 (or -1 to 0 or 0 to -1) gives 12 interations, one
> extra. --either 22 or 12, not 21 or 11. Anyway, one extra.
>
> An extra iteration is performed if 0 is within the range of the loop
> counter. It seems that when the counter reaches its max value, if 0 was in 
> the
> range, the max value is run one more time. For the example of 0 to 1, the 
> 1 is
> looped twice.
>
"Schwartz, Jonathan L." <jschwart at mitre.org> 
wrote in message 
news:17969D855F28964C88D177D45B6CDF11032FCB8C63 at IMCMBX2.MITRE.ORG...
> Has anyone had a problem with the following?
>
> 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,
 





More information about the use-livecode mailing list