Dave Cragg wrote:

This, combined with the slight but consistent speed advantage of the first method when referring to fields, makes me think we need some re- confirmation of the notion that the "limit expression" in a repeat loop is only evaluated once.


It is stated that way in the docs;  under repeat / with ...

As with the for number times form described above, the startValue and endValue are evaluated when the loop is first entered, and are not re-evaluated as a result of any actions performed in the statementList.

which seems clear enough, though slightly loose ... it would be more correct to say that they are evaluated BEFORE the loop is entered... as shown by


on mouseUp
  repeat with i = 1 to func(i)
    put ":" after msg
  end repeat
end mouseUp

function func x
  put "func" && x after msg
  return 3
end func

which results in

func 0:::

showing that the limit expression was calculated before the loop was entered, (and also that it was only calculated once).



-- Alex Tweedly http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 266.11.12 - Release Date: 17/05/2005

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to