repeat
Keyword
A repeat
loop is used any time you want to execute one or more statements repeatedly some number of times. The statements to be repeated are preceded by one of the repeat statements described below, and must always be followed by an end repeat
statement to mark the end of the loop. Repeat loops may be nested.
Examples
repeat
< number of times >
repeat 6 times
click "Arrow"
end repeat
repeat with
< n=1 to 7 >
put "Countdown"
repeat with n=10 down to 1
put n
wait one second
end repeat
put "BOOM!"
repeat until
<condition>
repeat until list is empty
put the last item of list
delete the last item of list
end repeat
repeat while
<condition>
put 10 into x
repeat while x < 100
add x to x
end repeat
repeat with each
<x in y>
repeat with each word of "To infinity and beyond!" whose length is greater than 3
log it -- Logs "infinity" on the first iteration and "beyond!" on the second iteration
typetext it
end repeat
repeat for
<duration> (Added in SenseTalk 1.49.)
repeat 1 minute
If imagefound(imageName:"Notification", waitFor:0) then
Logwarning "The warning is still present."
wait 2
else
Log "The warning is gone."
Exit Repeat
end if
end repeat
repeat until
<time> (Added in SenseTalk 1.49.)
repeat until "3:17 pm" // Repeats until the local system (eggPlant machine) clock hits 3:17 pm"
log "counting the seconds"
wait 1
end repeat
Further Reading
Resources in our other reference manuals.
Related Terms
Related terms in the SenseTalk Dictionary.