
126
Program Configuration
Section 7-4
array and the length of its name are dictated by the amount of available mem-
ory. An array has one subscript for each dimension in the array.
For example, T(4) would reference the fourth element in the one-dimensional
array T. R(2,3) would reference the value located in the second row and third
column of the two-dimensional array R.
The maximum number of dimensions of an array is 255. The maximum num-
ber of elements per dimension is 32767. The array size and number of dimen-
sions must be declared with the DIM statement. The subscript value zero is
the position of the first element in an array. All elements of an array must be of
the same TYPE. When an array is declared, numeric arrays are initialized as
zero, and alphabetic arrays are initialized as null strings. When a variable
array is used without being declared, it will be declared as a one-dimensional
array with elements 0 to 10, or 1 to 10 depending on the option base.
Note
In this example, the option base = 0
Example:
DIM A$(3)
This array is the one-dimensional, alphabetic A$ variable
array. The following 4 variables can be used.
DIM B(2,3)
This array is the two-dimensional, numerical B variable array.
The following 12 variables can be used.
7-4-7
Type Conversion
When necessary, BASIC will automatically convert a numeric constant from
one TYPE to another. The following rules apply.
1,2,3...
1.
If the numeric data on the right side of an assignment statement differs
from the type of data on the left side, the right side is converted to match
the left. Character data, however, cannot be converted to numerical data,
or vice versa without using functions (VAL, STR$)
Example:
A = 12.3: if A is an integer, then “12” is assigned to A.
2.
Double-precision data is converted to single-precision data when assigned
to a single-precision variable.
Example:
If “A” is a single-precision variable and the statement:
LET A = 12.3456789# occurs in a program, then 12.3456789# will be con-
verted to a single-precision number and then assigned to “A.” (A value
rounded to 6 digits will be displayed.)
3.
When an arithmetic operation is performed using both single-precision and
double-precision values, the single-precision value is converted to double-
precision first, and then the operation is performed. Therefore, the result is
a double-precision value.
Example
:
10#/3 (double-precision)
4.
In logic operations, all numeric data is first converted into long-integer data
unless both inputs are short integers. If any value cannot be converted into
A$(0)
A$(1)
A$(2)
A$(3)
B(0,0)
B(1,0)
B(2,0)
B(0,1)
B(1,1)
B(2,1)
B(0,2)
B(1,2)
B(2,2)
B(0,3)
B(1,3)
B(2,3)
Содержание C200H-ASC11
Страница 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Страница 2: ...iv...
Страница 4: ...vi...