English
Language : 

NSB8 Datasheet, PDF (101/158 Pages) List of Unclassifed Manufacturers – BASIC interpreter for Z80 family
ITALIAN TECHNOLOGY
grifo®
EXECUTION AND CONTROL FLOW
The action specified by each statement in a BASIC program is performed when that statement is
executed. In BASIC, statements are ususally executed in a sequential fashion, one after the
other. BASIC scans a program and executes its statements as you would read the program listing:
from lines with lower numbers to lines with greater numbers, and, if there is more than one statement
on a line, from the leftmost statement to the rightmost statement on that line.
The order of statement execution (also called control flow) may be altered through the use of several
special BASIC statements: GOTO, IF...THEN, FOR, NEXT, EXIT, GOSUB, RETURN
and ON…GOTO. Each of these CONTROL STATEMENTs is described in greater detail in its own
section of this manual.
A control statement forces BASIC to treat the line number it specifies or the program location it
implies as the location of the next statement to execute. Unless another control statement is
encountered, BASIC will return to sequential execution at the new location.
In BASIC programs, the natural flow of control is often diverted, in order to achieve savings in
program execution time and storage requirements. For example, repetition of program lines, a
powerful space saver, may be accomplished by using IF…THEN and GOTO statements. A common
repetitive looping technique uses the statements FOR and NEXT (and, occasionally, the EXIT
statement as well). Often, the program must make a choice on which of several alternative instruction
blocks is to be executed next, based on a given condition. IF…THEN statements are used to evaluate
the conditions and route control to the appropriate parts of the program. In certainsituations, the
ON…GOTO statement may be used in this capacity. Finally, GOSUB and RETURN are used to
implement subroutines, which allow a programmer to substitute single GOSUB statements for entire
large program segments, provided the segments (subroutines) are defined elsewhere in the program
text.
SEE ALSO:
Statement GOTO
Statement IF
Statement ON
Statement STOP
Statement END
Section THE FOR NEXT LOOP
Section PROCEDURES
Section FUNCTIONS
NSB8
Rel. 5.10
Page 89