
GeoBASIC Reference Manual
2.GeoBasic Constructs
TPS1100-Version 1.30
2-13
'
A2(2) = A1(2)
Note
Neither the compiler nor the interpreter does any index-overflow
checking. Hence overwriting of data outside an array may occur and
may cause severe errors, if indexes are use that is bigger than the
defined upper bounds.
♦
Arrays cannot be compared directly — it must be done element by element.
Often it is useful to declare constants for the upper bound of an array. (For a
description of the
IF
and
WHILE
statement see Sections 2.6.2.1 and 2.6.3.1.
respectively.)
CONST MaxNoOfHeights AS Integer = 10 'want to have
' 10 heights
TYPE DIM HeightArrayType(MaxNoOfHeights) AS Double END
DIM HeightArray1 AS HeightArrayType
'first array
' of heights
DIM HeightArray2 AS HeightArrayType
'second array
' of heights
DIM iIndex
AS Integer
'index for
' comparing
DIM lEqual
AS Logical
'indicator for
' comparing
'now compare the arrays
lEqual = TRUE
'so far everything was equal
iIndex = 1
'start with the first element
'compare the elements, stop at the first difference
DO WHILE lEqual AND (iIndex <= MaxNoOfHeights)
lEqual = (HeightArray1( iIndex ) =
HeightArray2( iIndex ))
iIndex = 1
LOOP
'do some action according to the result of the
'comparison
IF lEqual THEN
'yes, they are equal
ELSE
'no, they are not equal;
'the first difference is at position iIndex - 1
END IF
♦
Now declare some larger arrays.
TYPE DIM DoubleArrayType ( 20 ) AS Double END
Содержание 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 ...