120
Compiler
© 2008 Conrad Electronic
5.3.6.6
Select Case
If depending on the value of an expression various commands should be executed then a Select
Case instruction seems to be an elegant solution:
Select Case Expression
Case constant_comparison
1
Instructions_
1
Case constant_comparison
2
Instructions_
2
.
.
Case constant_comparison_x
Instructions_x
Else
' Else is optional
Instructions
End Case
For constant comparisons special comparisons and ranges can be defined . Here examples for all
possibilities:
Comparison
Execute on
Constant,
=
Constant
Expression
equal
Constant
<
Constant
Expression
smaller
Constant
<=
Constant
Expression
smaller equal
Constant
>
Constant
Expression
greater
Constant
>=
Constant
Expression
greater
equal
Constant
<>
Constant
Expression
unequal
Constant
Constant1
To
Constant2
Constant1
<=
Expression
<=
Constant2
The new features to use comparisons are introduced for Select Case statements with version
1.71. This extension is not available for CompactC switch statements.
The value of the Expression is calculated. Then the program execution will jump to the first constant
comparison that can be evaluated as true and will continue the program from there. If no constant
comparison can be fulfilled the Select Case construct will be left.
If an Else is defined within a Select Case instruction then the instructions after Else will be
executed if no constant comparison could be fulfilled.
Example:
Select Case a+
2
Case
1
b=b*
2
Case =
5
*
5
b=b+
2
Содержание C-Control Pro Mega Series
Страница 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Страница 9: ...VIII Inhalt 2008 Conrad Electronic ...
Страница 10: ...Part 1 ...
Страница 17: ...Part 2 ...
Страница 23: ...Part 3 ...
Страница 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Страница 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Страница 58: ...Part 4 ...
Страница 91: ...82 IDE 2008 Conrad Electronic ...
Страница 92: ...Part 5 ...
Страница 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Страница 136: ...Part 6 ...
Страница 231: ...Part 7 ...
Страница 240: ......