Equinox Online Help - Language Reference - A to Z

Home

While ... End While

Applies to
Syntax
While TestExpression
statements
[Exit while]
[Continue While]
end while

Note that you may use EndWhile instead of End While.

Action[Statement] The enclosed statements repeat while the test expression is True.
ScopeUsable anywhere.
Notes

TestExpression is evaluated. If it is True, the statements enclosed between While and End While execute. This repeats until TestExpression evaluates to False.

Exit While passes control to the statement following End While. Continue While passes control back to the While statement. You may nest While statements to as many levels as required.

Note that unlike the Repeat statement the enclosed statements will not be executed if the condition is evaluated False on the first examination.

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

This method sets up a daily call list for a salesman, containing prospects whose potential sales value (held in the field ProspectValue) is not zero and who have no salesman allocated to them (held in ProspectCaller).

The While statement limits the number of prospects to fifty. If the last prospect is reached before fifty are found, then SysError is set non-zero and an Exit While statement is used to close the loop.

number NoFound
...

BlankIndex daylist

subtable customer
SetIndex NoIndex

NoFound = 0
FirstRecord

While NoFound < 50
If SysError Then Exit While

if ProspectValue <> 0 and ProspectCaller = "" then
MarkIndex daylist
NoFound += 1
end if
NextRecord
end while
end subtable | customer