DataBasic Reference > Statements and Intrinsic Functions > D > DIMENSION Statement

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

RealityV15.1Online Documentation (MoTW) Revision 7

DIMENSION Statement (DataBasic) (m618703+dimension_s.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

DIMENSION Statement

Dimensions arrays so they can be used in a DataBasic program.

Syntax

DIM{ENSION} arrayName(dimensions){,arrayName(dimensions)...}

Syntax Elements

arrayName The name of the array to be dimensioned.

dimensions The size of the array.

An array can be one-dimensional, (vector) or two-dimensional (matrix). See Dimensioned Arrays for more details and the limits on the number of elements.

Comments

The maximum dimensions of an array must be specified with a DIMENSION or COMMON statement. The dimensions must be declared with literal integers greater than 0 or symbols that represent literal integers, separated by commas. A DIMENSION (or COMMON) statement must precede any reference to the array it dimensions and is usually placed at the beginning of the program.

An array that is specified in a COMMON statement must not be specified in a DIMENSION statement.

You can dimension several arrays with a single DIMENSION statement. For example:

DIMENSION A1(10, 5), X(50)

This example declares Array A1 as a 10 by 5 matrix and declares Array X as a 50-element vector.

Notes:

Examples

DIMENSION MATRIX(10, 12)

Specifies a 10 by 12 matrix called MATRIX.

EQU ROWS TO 10
EQU COLS TO 12
.
.
.
DIMENSION MATRIX(ROWS, COLS)

Specifies the same matrix as above, using symbols for the dimensions.

DIM Q(10), R(10), S(10)

Specifies 3 vectors named Q, R and S, each of which contains 10 elements.

RealityV15.1 (MoTW) Revision 7Comment on this topic