
GeoBASIC Reference Manual
2.GeoBasic Constructs
2-28 TPS1100-Version
1.30
♦
If
a
is greater than
b
,
Stat1
will be executed. If
a
is smaller than
b
,
Stat2
will be executed. The
ELSE
case means that neither
a
is greater
b
, nor
a
is
smaller
b
— hence
a
equals
b
. In that case
Stat3
is executed.
IF a > b THEN
Stat1
ELSEIF a < b THEN
Stat2
ELSE 'a = b
Stat3
END IF
Note
In general the branch conditions in the
IF
-Statement must neither be
exclusive nor complete. Hence the compiler will not check if any branch
is accessible.
♦
The built in function
Abs
computes the absolute value of a number, i.e. takes a
number and computes its value as a non-negative integer ("forgets its sign"). It
can be written as the following program that does nothing if
x
is already non-
negative, and converts
x
to a positive number if the current value is negative.
The empty
ELSE
case can be omitted.
IF x < 0 THEN
x = -x
END IF
♦
Another example is given in the next Section 2.6.2.2 on The SELECT-
Statement.
2.6.2.2 The SELECT-Statement
The expression is evaluated and compared to the constants. If a constant equal to
the value of the expression is found, the corresponding statement sequence is
executed. If no constant equals the expression and there is a
CASE
ELSE
, the
statement sequence following this is executed, otherwise nothing more is done.
Execution then continues with the statement after
END
SELECT
.
The expression and the constants must be of a simple type or strings, and the
constants should all have different values. The order of the constants in the list,
and the order of the lists in the
SELECT
-statement is irrelevant as far as the effect
of the statement is concerned; however, the constants will be checked for equality
in the order in which they appear, so if the most frequent case is put first, this will
likely result in faster execution.
Содержание 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 ...