Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileGOTO label label: label name By means of a 'label', specific locations in the program can be defined and a program started from this point with the instruction 'GOTO label'. Program execution is commenced from the label position. The label can consist of letters, numbers, underlines, and periods. However, unlike variable names, it may also begin with a number. It must, however, end with a colon. The colon should be left off when refering to a label in a GOTO command. The use of GOTO is not allowed for jumping out of procedures, functions, or FOR-NEXT loops into the main part of the program. The use of this command also leads to unclear program structures which are not easy to follow and, it is generally considered, GOTO's should be avoided wherever possible. Example: PRINT "place 1" GOTO jump_point PRINT "place 2" jump_point: PRINT "place 3" --> The texts "place 1" and "place 3" appear on the screen. Memo: If the label used with GOTO is undefined the compiler will not issue an error message. Instead the compiler writes a bad binary where GOTO is translated into JMP 0.l! This example shows what is and what is not valid when using the GOTO command: FOR j=0 TO 31 IF i=15 ' GOTO label3 !no good ENDIF NEXT j FOR i=0 TO 31 IF i=15 ' GOTO main1 !no good GOTO label3 !ok jump within the same loop ENDIF label3: NEXT i ' GOTO label1 !no good ' GOTO label2 !no good ' GOTO label3 !no good main1: ' PROCEDURE proc1 GOTO label1 !ok jump into another procedure from a procedure ' GOTO label2 !no good ' GOTO main1 !no good RETURN PROCEDURE proc2 GOTO label1 !ok jump within the same procedure label1: RETURN FUNCTION func1 GOTO label2 !ok jump into another function from a function ' GOTO label1 !no good ' GOTO main1 !no good RETURN 0 ENDFUNC FUNCTION func2 GOTO label2 !ok jump within the same function label2: RETURN 0 ENDFUNC