Language Elements

BASIC-80

String Arrays

Like numeric arrays, string arrays can be dimensioned with the DIM statement. The format for dimensioning a string array is the same as for numeric arrays:

DIM A$(5,25,40)

If you don't execute a DIM statement, a default of 10 for each subscript is assumed. If this value is then exceeded, an error message will result.

Table 2-6. BASIC-80 Operators in Order of Precedence

Order

Operator

Example

 

 

 

1.

Expressions in parentheses.

(A+B)

2·.

Exponentiation, as shown in the example,

AtB

 

where A is raised to the B power.

 

 

3.

Negation, represented by the minus sign.

-A

4.

Multiplication and Division, represented by

A*B

 

an asterisk (*) and a slash (I) respectively.

AlB

5.

Integer division, represented by a

 

 

backslash ( ). Both arguments are con-

A\B

 

verted to integer values and the result is

 

 

 

truncated to an integer.

 

6.

Integer Modulus, represented by MOD.

 

 

Both arguments are converted into in-

AMODB

 

tegers. The result is the remainder when

 

 

 

the first is divided by the second.

 

7.

Addition and Subtraction, represented by

A+B

 

(+) and minus (-) signs.

A-B

8.

Relational Operators. These are listed

 

 

without precedence. For all relational

 

 

operators, the result is -1 if true, and 0 if

 

 

false. The arguments A and B must be both

 

 

strings or both numeric variables.

 

 

Equals sign: Used to test for equality.

A=B

 

Greater Than: Used to test magnitude be-

 

 

tween two arguments. The large end of the

A>B

 

sign faces the posited greater value.

 

 

Less Than: Used to test magnitude between

 

 

two arguments. The small end of the

A<B

 

sign faces the posited less.er value.

 

 

Not Equal: Used to test for inequality be-

A><B

 

tween two arguments.

A<>B

 

Greater Than or Equal To: Used to test

A=>B

 

magnitude down to the level of the second

 

A>=B

 

argument.

 

 

 

Less Than or Equal To: Used to test

A=<B

 

magnitude up to the value of the second

 

A<=B

 

argument.

 

 

 

 

 

In the Logical Operators below, the arguments are converted to 16-bit, signed two's complement integers in the range -32768 to +32767. The result of the operation is converted to the same format. The operations are performed one bit at a time, com- paring the nth bit of X with the nth bit of Y.

2-10

Page 20
Image 20
Intel 9800758-02 manual String Arrays