Sharp MZ-700 Series Owner's Manual page 27

Personal computer
Hide thumbs Also See for MZ-700 Series:
Table of Contents

Advertisement

(Example 1)
1 0
D I M
2 0
D I M
A ( 5 ) -
X $ ( 8 )
Declares 1-dimensional numeric array A with 6 elements.
Declares 1-dimensional string array X$ with 9 elements.
1 0
D I M
ACS), X S C 8 )
Performs the same function as lines 10 and 20 above.
(Example 2)
1 0
D I M
B C 5 , 5 )
Declares 2-dimensional numeric array B with
6 x 6
elements.
2 0
D I M
Y S C 5 , 8 )
Declares 2-dimensional string array Y$ with 6 x 9 elements.
1 0
D I M
B C 5 , 5 ) , Y S C 5 , 8 ) , A C 5 ) , X S C 8 )
Declares two numeric arrays
and two string arrays.
(Example 3)
1 0
D I M
C C 3 , 3 , 3 )
Declares 3-dimensional array C with 4 x 4 x 4 elements.
Note: Different names must be used for each array which is declared; for example, the instruction DIM
A(5), A(6) is not a legal array declaration.
Try executing the program shown below and check the results which are obtained.
1 0
D I M
A C 2 ) ,
B S C 2 )
2 0
A ( 0 ) = 2 6
3 0
AC1 ) = 9
4 0
A ( 2 ) = —1 0 0
5 0
B $ ( 0 ) = " A B C ".
6 0
B $ ( 1 ) = " X Y Z "
7 0
B $ ( 2 ) = " M Z - 7 0 0 "
8 0
P R I N T
AC1 )
9 0
P R I N T
B $ ( 2 )
1 0 0
P R I N T
A C 2 )
1 1 0
P R I N T
B $ ( 0 ) + B $ ( 1 )
1 2 0
P R I N T
A ( 0 )
Note: Individual variables within an array, such as A(5) and X$(8), are referred to as an array's elements.
Numeric constants, numeric variables, and numeric arrays are collectively referred to as numeric
expressions, and string constants, string variables, and string arrays are collectively referred to as
string expressions.
25

Advertisement

Table of Contents
loading

Table of Contents