Equinox Online Help - Language Reference - A to Z

Home

Repeat ... Until

Applies to
SyntaxRepeat statements [Exit Repeat] [Continue Repeat] Until TestExpression
Action[Statement] The enclosed statements continually repeat until TestExpression becomes True.
ScopeUsable anywhere.
Notes

The statements execute and TestExpression is evaluated. If TestExpression is True then control returns to the first line after the Repeat statement.

Exit Repeat passes control to the next statement after the Until statement. Continue Repeat causes control to return directly to the first line after the Repeat statement. You may nest Repeat to as many levels as required.

Note that the Repeat statement is similar to While, except that TestExpression is tested at the end of the structure, not the beginning. Thus execution of the enclosed statements occurs at least once.

CategoryFlow Control
See Also Block_EndBlock, BreakPressed, Continue, Execute, EnableInput, Exit, For...Next, Goto, If_Then, Repeat_EndRepeat, Return, Sleep, Subtable, Switch, While_EndWhile
Example

The following example is an adhoc security system. The user is asked for their name and password and is allowed three attempts before the system closes down.

number tries
string name, code

tries = 0

Repeat
tries += 1
name = Input("Enter your name")
code = InputPassword("Enter your password")

subtable usr
SetIndex UsrName
FindRecord EQ, name

| if user not found, keep trying
if syserror then continue repeat
if code = UsrPassword then exit method
end subtable | usr
Until tries = 3

Exit Application