The @GOTO statement is used in a @DO procedure to execute an unconditional branch to the specified line.
Operation | Operands | @PROC |
@GOTO | line |
line | The line operand designates the line number to be branched to. |
The @GOTO statement is only permitted in @DO procedures. If @GOTO is specified outside of a @DO procedure then it is rejected with the message EDT4942
. In an @INPUT procedure, the message is output and processing continues with the statement which follows the illegal @GOTO statement.
If line
is a line number variable which has the value 0.0000
at the time the branch is executed (this corresponds to the preset values of line number variables when EDT is started), then the @GOTO statement is rejected with the message EDT4932
and the procedure continues with the statement which follows the invalid @GOTO statement.
The line which is branched to with @GOTO must exist in the associated procedure. If an attempt is made to branch to a line which does not exist then error message EDT4974
is issued and the procedure continues with the statement which follows the invalid @GOTO statement.
If lines are to be branched to by means of @GOTO in EDT procedures then it is advisable to always define the line numbers of these lines explicitly by means of the @SET statement (format 6) in order to ensure that the numbers of the lines that are to be branched to do not change implicitly if statements are inserted or deleted.
Note
It is not advisable to use symbolic line numbers since these always refer to the current work file and not therefore to the procedure work file.
If the first statement in a procedure is the @PARAMS statement then this cannot be branched to with @GOTO.
Example
1. @SET #I3 = 1 -------------------------------------------------- (1) 1. @PROC 3 1. @1 ------------------------------------------------------------ (2) 1. @ @IF #I3 > 5 : @RETURN --------------------------------------- (3) 2. @ @STATUS = #I3 3. @ @SET #I3 = #I3+1 4. @ @GOTO 1 5. @END 1. @DO 3 --------------------------------------------------------- (4) #I03= 0000000001 #I03= 0000000002 #I03= 0000000003 #I03= 0000000004 #I03= 0000000005 1.
(1) | The value 1 is assigned to the integer variable #I3 . |
(2) | Specification of the line number which is branched to by means of @GOTO. |
(3) | If the procedure is executed in work file 3 then the value assigned to the integer variable |
(4) | The procedure in work file 3 is executed. |