BASIC-80

Commands and Statements

NEXT

The NEXT statement is used with a previous FOR statement to end an iteration of a FOR-NEXT loop; when BASIC-SO encounters a NEXT statement, control passes back to the statement line containing the last FOR statement. If no index variable is specified, BASIC-SO increments the variable specified in the last FOR statement. Each NEXT can end more than one loop if the index variables used in each loop are given separated by commas.

The syntax of NEXT is:

NEXT [Variable] [, Variable] ...

10FOR A=1 TO 5

20PRINT A* A;

30NEXT A

40END

RUN

14 9 16 25

Ok

NULL

The NULL command specifies the number of null characters printed at the end of a printed line, following the carriage return. This feature is used with hard copy ter- minals that require a certain number of null characters that set carriage return timing.

NULL number of null characters to be transmitted

ON ERROR GOTO

The ON ERROR OOTO statement transfers program control to the specified line number when error conditions occur or an ERROR instruction simulates an error within a program. The ERR function is set to the applicable error code and the ERL function is set to the applicable line number.

The instruction line ON ERROR OOTO 0 removes the effect of any previous ON ERROR OOTO, so that errors cause messages to print and halt execution. If ON ERROR OOTO 0 is executed within an error-handling routine (after an error but before a RESUME) the proper error message prints and execution halts immediately.

If an error occurs in an error routine, after an ON ERROR OOTO branch and before a RESUME, the ON ERROR OOTO has no effect. This means that if an ON ERROR OOTO is in effect, and two errors (or ERROR commands) occur without an intervening RESUME, the second error prints an error message and halt execution.

ON ERROR GOTO line number

10 ON ERROR GOTO 200

20 ERROR 11

200 PRINT "ERROR" ERR "AT LINE" ERL

210 RESUME NEXT

6-13

Page 53
Image 53
Intel 9800758-02 manual Next, 9 16