ProvideX V8.20 > Language Reference > 2. Directives
124
EXITTO Directive
             End Loop, Transfer Control
Format
EXITTO [stmtref]
Where:
stmtref
Program line number or label to transfer control to.
Description
The EXITTO directive terminates the currently active FOR..NEXT, GOSUB..RETURN,
REPEAT..UNTIL or WHILE..WEND loop prematurely and transfers control to the
statement number indicated.
EXITTO lets you terminate one of these processes early by removing its associated
entry from the top of the stack. If there is no active entry on the stack, ProvideX
returns Error #27: Unexpected or incorrect WEND, RETURN, or NEXT.
When used in a compound statement, EXITTO must be the final directive.
See Also
FOR..NEXT Loop While Incrementing, p.133
GOSUB.. Execute Subroutine, p.140
REPEAT..UNTIL Repetitive Execution, p.285
WHILE..WEND Repeat Statements, p.373
Flow Overrides, User's Guide.
Example
00010
BEGIN
00020
FOR i=1 TO 10
00030
INPUT x
00040
IF CTL=4 \
THEN EXITTO 0060
00050
acc+=x
00060
NEXT i
00070
IF i>1 \
THEN avg=acc/(i-1)
00080
PRINT avg