![background image](http://html.mh-extra.com/html/conrad/c-control-pro-mega-series/c-control-pro-mega-series_manual_2654183129.webp)
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
Summary of Contents for C-Control Pro Mega Series
Page 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Page 9: ...VIII Inhalt 2008 Conrad Electronic ...
Page 10: ...Part 1 ...
Page 17: ...Part 2 ...
Page 23: ...Part 3 ...
Page 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Page 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Page 58: ...Part 4 ...
Page 91: ...82 IDE 2008 Conrad Electronic ...
Page 92: ...Part 5 ...
Page 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Page 136: ...Part 6 ...
Page 231: ...Part 7 ...
Page 240: ......