beautypg.com

Array variables, Arithmetic operation – MITSUBISHI ELECTRIC T-60 User Manual

Page 46

background image

Array Variables

An array is a group or table of values referenced by the same variable name.
Each element in an array is referenced by an array variable that is a

subscripted integer or an integer expression. The subscript is enclosed
within parentheses. An array variable name has as many subscripts as there

are dimensions in the array.

For example,

V(10)

references a value in a one-dimensional array, while

T(1,4)

references a value in a two-dimensional array.

The maximum number of dimensions for an array in EMERSON EMC
BASIC is 16383. Arrays cannot have a size greater than 32767 bytes. i.e.

A(8191), b%(16383), and s$(16383) are all valid. A(8192), b%(16384), and
s$(16384) are all invalid sizes for arrays. See 6.2.4 for a description of

memory space requirements.

Multi-dimensional arrays (more than one subscript separated by commas)

are useful for storing tabular data. For example, an array dimensioned with
DIM A(2,5) could be used to represent a two-row, five-column array such as
the following:

Column

1

2

3

4

5

Row 1

10

20

30

40

50

Row 2

60

70

80

90

100

In this example, element A(2,3)= 80 and A(1,4)= 406.3

Arithmetic Operation

The following are the arithmetic operators recognized by EMERSON EMC

BASIC. They appear in order of precedence.

Operator:

Operation:

^

Exponentiation

-

Negation

*

Multiplication

/

Floating-point Division

MOD

Modulus

+

Addition

-

Subtraction

Operations within parentheses are performed first. Inside the parentheses,

the usual order of precedence is maintained. Two consecutive operators must
be separated by parentheses.

T-60 Operator's Manual

38