Language Elements |
Converting Data
It is sometimes useful to convert one type of data into another.
The HEX$ and OCT$ functions return a string of hexadecimal and octal digits, respectively, that represent the numeric argument. The STR$ function returns a string of decimal digits that represent the decimal value of the argument. The VAL function returns the numeric value of the string argument, if the string is a number.
CHR$ returns the ASCII equivalent of an integer argument, between 0 and 255.
The CVI, CVS, and CVD functions convert a given string into integer, single- preci- sion
The MKI$, MKS$, and MKD$ functions convert integer,
You can convert a numeric variable (integer,
A# = CDSl (A%)
l4! = CSNG (l4)
VAR5 = CINT (VAR5)
Array Variables
An array is a group of variables identified by the same name, specified by subscripts that define their position in the array. An array variable can have as many dimen- sions as will fit on a single line. An array variable is specified by following a variable name with as many subscripts as there are dimensions. A subscript must be an in- teger value, and enclosed within parentheses or square brackets. If there is more than one subscript, separate them with a comma. Expressions can be used to specify subscripts; they are rounded to integer form. Here are some array variables:
X(10)
R1 (5,4)
Y(I,1)
SA(I + 3,X(10))
The DIM statement allocates array space and specifies the maximum allowable subscript for a given dimension. If an array variable is referenced before it has been formally dimensioned,
DIM X(15)
DIM R1(12,8)
DIM K(17,24)
An attempt to specify an array variable whose subscripts are larger than the dimen- sioned value, or which exceed 10 in the default mode, causes a SUBSCRIPT OUT OF RANGE error message~