Commands and Statements

BASIC-SO

ON ... GOSUB

The ON ... GOSUB statement transfers program control to one or one of a set of subroutines.The line numbers of the first lines of these subroutines follow sequen- tially, separated by commas. If the expression evaluates to 3, control transfers to the third line number following GOSUB.

ON expression GOSUB line number [,Iine number] ...

10 INPUT A

20 ON A GOSUB 200,300

ON ... GOTO

The ON ... GOTO statement transfers program control to one or one of a set of line numbers. The expression X is evaluated and control is transferred to the "nth" line number following the line containing the ON ...GOTO instruction. If the expression evaluates to 3, control transfers to the third line number following GOSUB.

ON expression GOTO line number [,Iine number] ...

10 INPUT A

20 ON A GOTO 500,510,520

OPEN

The OPEN statement makes an ISIS-II file available to BASIC. It also associates a file number from 1 to 6 with the file. File type can be I, 0, or R. Random 110 files are specified by an R, sequential input files are specified by an I, and sequential output files are specified by an 0, as shown in the syn- tactic format below. The file number is an integer expression greater than 0 and less than or equal to 6, is preceded by a "#" sign, and is used to reference the file in 110 transactions.

Only six files may be open at one time. Note that SAVE, LOAD, DSKF; DIR and MERGE all require a file, so a maximum of five files may be open before they are executed.

BASIC-SO buffers files, so if :CI: is opened for input, BASIC-SO will wait for the first line of console input.

OPEN type, [I] file number, filename

where type is a string expression equal to "0", "I" or "R". In the example below, the file SYSLIB is opened as a random I/O file, with number 4.

OPEN "R" ,#4, "SYSLlB"

6-14

Page 54
Image 54
Intel 9800758-02 manual On ... Gosub, On ... Goto, Open