ProvideX V8.20 > Language Reference > 2. Directives
141
GOTO Directive
            Transfer within Program
Format
GOTO stmtref
Where:
stmtref
Program line number or label to transfer control to.
Description
Use the GOTO directive to have ProvideX transfer execution to the given statement
number or label. If the line doesn't exist, then the statement with the next higher
number will be used.
The GOTO directive can be used in either Execution or Command mode. In
Command mode, the GOTO directive causes execution to begin at the statement
number specified upon execution of the next RUN directive.
If you use GOTO in a compound statement, it must be the final directive.
Examples
In Execution mode:
0010
INPUT "Enter a number: ",A
0020
IF A=0 THEN PRINT "DONE"; STOP
0030
PRINT A," multiplied by 2 is ",A*2
0040
GOTO 0010
In Command mode:
-:GOTO 10
-:RUN
Enter a number:
1
1 multiplied by
2 is 2
Enter a number:
3
3 multiplied by
2 is 6
Enter a number:
0
DONE
-: