Definition Statements - Sharp MZ-80B Basic Manual

Personal computer double precision disc
Hide thumbs Also See for MZ-80B:
Table of Contents

Advertisement

50
IF - GOSUB
3 0 IF A=B* 2 GOSUB 90
ON - GOTO
50 ON A GOTO 70, 80, 90
ON - GOSUB
90 ON A GOSUB 700, 800
3 . 1 . 1 1 Defini tion statements
DIM
10 DIM A (300)
20 DIM B (79, 79)
3 0 DIM C I $ ( 1 0)
40 DIM K$ ( 7 , 5)
1 00 DEF FNA (X)=X ' 2-X
DEF FN
1 1 0 DEF FNB(X)=LOG (X)
1 20 DEF FNZ (Y)=LN (Y)
Jumps to the subroutine starting on line number 700 when the
value of variable A is twice the value of B ; otherwise the next state­
ment is executed.
(When other statements follow a conditional statement on the
same line and the conditions are not satisfied, those following an
ON statement are executed sequentially, but those following an I F
statement are ignored and the statement on the next line i s exe­
cuted.)
Jumps to the statement on line number 70 when the value of vari­
able A is 1 , to the statement on line number 80 when it is 2 and to
the statement on line number 90 when it is 3 . When the value of A
is 0 or more than 3, the next statement is executed. This statement
has the same function as the INT function, so that when the value
of A is 2 . 7 , program execution jumps to the statement on line
number 80 .
Jumps to the subroutine on line number 700 when the value of
variable A is 1 and jumps to the subroutine on line number 800
when it is 2 .
When an array i s used, the number of array elements must b e
declared with a DIM statement . F o r an one-dimensional array , the
number of array elements is only limited by the amount of the
unused memory area. For a two-dimensional array, however, it is
limited by the maximum value of each subscript which is 2 5 5 .
D eclares that 30
for one-dimensional numeric array A (n).
Declares that 6400 array elements, B (0, 0) through B (79, 79), are
used for two-dimensional numeric array B (m , n).
Declares that 1 1 array elements, C l $ (0) through C l $ ( 1 0), are
used for one-dimensional string array C 1 $ (n).
Declares that 48 array elements, K$ (0, 0) through K$ (7, 5 ), are
used for two-dimensional string array K$ (m, n).
A DEF FN statement def mes a function. The statement on line
number 1 00 defines FNA (X) as X 2 -X. The statement on line
number 1 1 0 defines FNB (X) as Jog10 X + l and the statement on
+ I
line number 1 20 defines FNZ (Y) as l oge Y. The number of vari­
ables included in the function must be 1 .
I
(O)
array elements, A
through A (300), are used

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents