BASIC-SO

Commands and Statements

DELETE'

The DELETE command removes specified instruction lines from program tex,t. A single line or block of lines may be deleted, as shown in the syntactic format and example below. Instruction lines prior to and including the specified line may be deleted by adding a dash (-) before a line number. When deleting a range of lines, the line numbers specified as end points must exist. If not, an error results.

DELETE line numberlline number-line numberl-line number

10 PRINT CHR$(12)

20 PRINT:PRINT:PRINT

30REM THIS PROGRAM FINDS THE AVERAGE

40REM OFTHREE NUMBERS

50INPUT A,B,C

60PRINT (A+ B+C)/3

70END DELETE-40

OK LIST

50INPUT A,B,C

60PRINT (A + B + C)l3

70END

OK DELETE 70 OK

LIST

50INPUT A,B,C

60PRINT (A+ B+ C)/3

Ok

DIM

The DIM statement defines the number of elements in an array variable. If an array variable is not dimensioned before it is referenced, a default value of 10 is assumed as the maximum possible subscript range for each dimension in the reference. If given, DIM statements must allocate space before you refer to the arrays they dimension, since once an array is dimensioned, these dimensions cannot be changed. If an OPTION BASE n statement is used in the program to specify starting points for arrays, it should precede the first DIM statement, or array reference.

DIM variable (integer [,integer] ...) [,variable (integer [,integer] ... )... ]

In the example below, A is a single precision array with 21 elements, indexed with a value of from 0 to 20. I is an integer array with 13 times 14 (= 182) elements. S$ is a three dimensional string array with 125 elements. DD# is a singly dimensioned double precision array with 22 elements.

10 DEFINT I-N

20 DIM A (20), 1(12,13), S$ (4,4,4), DD# (21)

6-5

Page 45
Image 45
Intel 9800758-02 manual Dim, Delete