
GeoBASIC Reference Manual
2.GeoBasic Constructs
TPS1100-Version 1.30
2-11
2.2.3
Declaration of Arrays
An array consists of a fixed number of values of the
same
type, organised in one or
more dimensions (vector, matrix, three-dimensional array, etc.) and is declared as
follows.
Syntax:
ArrayDeclaration ::= "
TYPE
" "
DIM
" Name SubscriptList "
AS
"
DataType
"
END
" [ Name ]
DataType
::= ( DataTypeName | "
STRING
" "
*
" Length )
SubscriptList ::=
"
(
" UpperBound { "
,
" UpperBound } "
)
"
UpperBound ::=
IntegerConstant
Length ::=
IntegerConstant
•
A variable of type "Name" will consist of an array of as many dimensions as
there are
bounds
specified. The upper bounds must be positive integer
constants.
•
Subscripting
starts at 1; thus each dimension has "UpperBound" entries. Each
element of the array will be of the data type specified.
•
An individual element is
accessed
by giving its subscripts (coordinates) as
expressions (see Section 2.4 on Variables).
•
For assignment and parameter passing, the variable may also be used as a
whole. Other operations can only be performed on the individual elements; in
particular, comparison of entire arrays is not possible.
Examples:
♦
Declare a type for an array that contains two integers, and a variable of that
type.
TYPE DIM MyFirstArrayType ( 2 ) AS Integer END
DIM MyFirstArray AS MyFirstArrayType
♦
Now we can access the two components as individual variables.
MyFistArray(1) = 10
MyFistArray(2) = 20
MyFirstArray(1) = MyFirstArray(2) DIV MyFirstArray(1)
Содержание tps1100
Страница 1: ...GeoBASIC FOR TPS1100 User Manual Version 2 10 1997 2001 Leica Geosystems AG Heerbrugg Switzerland ...
Страница 150: ...GeoBASIC FOR TPS1100 Reference Manual Version 2 10 1997 2001 Leica Geosystems AG Heerbrugg Switzerland ...
Страница 411: ...GeoBASIC Reference Manual 6 System Functions TPS1100 Version 1 30 6 7 6 5 35 CSV_LibCallAvailable 6 213 ...
Страница 620: ...TPS1100 Version 2 10 6 1 ...
Страница 621: ......
Страница 623: ...TPS1100 Version 2 10 6 1 ...
Страница 624: ......
Страница 1053: ...TPS1100 Version 1 30 E 1 Appendix E GEOFONT ...
Страница 1154: ...GeoBASIC Reference Manual Appendix J List of Predefined Identifiers TPS1100 Version 1 30 J 9 TMC_SetOffsetDist 6 128 ...