This article on MacTech summarizes the loop flow control structures in AppleScript which apparently amounts to the “repeat” command.
repeat -- code end repeat
this will repeat indefinitely but you can exit the repeat within such a block by adding something like this:
if stopMe = true then exit repeat end if
You can also repeat a fixed number of times:
repeat 5 times -- code end repeat
You can also repeat until some condition:
repeat while keepGoing = true -- code end repeat
repeat until stopMe = true -- code end repeat
Finally there is a kind of repeat which is familiar to anyone who has used increments in for loops in other programming languages:
repeat with x from 1 to 10 -- code which can refer to the number x which increases with each repeat end repeat

One Comment
Simple, clean advice. Thanks.
Really nice site, mate!
Post a Comment