Language Guide
CHAPTER 7
Control Statements
198 Repeat Statements
Repeat (number) Times 7
The Repeat (number) Times form of the Repeat statement repeats a group of
statements a specified number of times.
SYNTAX
repeat integer [ times ]
[ statement ]...
end [ repeat ]
where
integer is an integer that specifies the number of times to repeat the statements
in the body of the loop. The word times after integer is optional.
statement is any AppleScript statement.
EXAMPLE
The following example numbers the paragraphs of a document with the Repeat
(number) Times form of the Repeat statement.
tell document "List"
set numParagraphs to (count paragraphs)
set paragraphNum to 1
repeat numParagraphs times
set paragraph paragraphNum to (paragraphNum as string) & " "
& paragraph paragraphNum
set paragraphNum to paragraphNum + 1
end repeat
end tell