
GeoBASIC Reference Manual
2.GeoBasic Constructs
TPS1100-Version 1.30
2-29
There is no check to assure that the constants are all different. If there is more than
one constant equal to the value of the expression, the first one will always be
selected; the other cases will therefore be inaccessible.
Example:
♦
Assume that the sum of the variables
a
and
b
denotes an integer, and we
want to check if this number is a prime number smaller than 10, a prime
number between 10 and 20, or not a prime number at all.
SELECT CASE a+b
CASE 2, 3, 5, 7
Stat1
CASE 11, 13, 17, 19
Stat2
CASE ELSE
Stat3
END SELECT
♦
Note that if had used a nested
IF
statement, we would have to write a lot of
comparisons that make the code much less readable. (Further, if we do a
straight forward transformation from
SELECT
to
IF
, the selection expression
is evaluated more than once, in the general case.)
IF (a+b)=2 OR (a+b)=3 OR (a+b)=5 OR (a+b)=7 THEN
Stat1
ELSEIF (a+b)=11 OR (a+b)=13 OR (a+b)=17 OR (a+b)=19 THEN
Stat2
ELSE
Stat3
END IF
2.6.3 Iteration
Statements
Syntax:
LoopStatement
::= ( WhileLoop | UntilLoop | ForLoop )
WhileLoop ::=
"
DO
" [ "
WHILE
" Condition ]
StatementSequence
"
LOOP
"
UntilLoop ::=
"
DO
"
StatementSequence
"
LOOP
" [ "
UNTIL
" Condition ]
ForLoop ::=
"
FOR
" CounterName "
=
" Start "
TO
"
Содержание 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 ...