Control Structures

repeat

Supported By

Syntax

repeat [forever]
   statementList
end repeat

repeat [for] number [times]
   statementList
[(lastly|then|else)
   statementList]

end repeat

Number yields a non-negative integer specifying how many times the loop is executed.

Examples

put zero into x
repeat forever
  add 1 to x
  put x
  if x is ten then exit repeat
end repeat
put one into x
repeat 10
  put x
  add 1 to x
end repeat
put one into x
repeat 10 times
  put x
  add 1 to x
end repeat

Description

The repeat structure without a number causes all the statements inside to execute in a loop until an exit, pass, return, or throw keyword is reached. The repeat structure with a number causes all the statements inside to execute in a loop with the specified number of iterations.

In OpenXION 1.3 and later, the statements under a lastly, then, or else keyword inside a repeat structure will be executed when the loop ends, unless the loop has ended because of an exit, pass, return, or throw.

Synonym

repeat for

See Also

repeat for each, repeat foreach, repeat until, repeat while, repeat with