101
C-Control Pro Mega Series
© 2008 Conrad Electronic
corresponding to the value of the Expression and will continue the program from there. If no constant
corresponds to the value of the expression the switch construct will be left.
If a default is defined within a switch instruction then the instructions after default will be executed
if no constant corresponding to the value of the instruction has been found.
Example:
switch(a+
2
)
{
case
1
:
b=b*
2
;
break;
case
5
*
5
:
b=b+
2
;
break;
case
100
&
0xf
:
b=b/c;
break;
default:
b=b+
2
;
}
break Instruction
A break will leave the switch instruction. If break is left out ahead of case then the instruction will
be executed even when a jump to the preceeding case does take place:
switch(a)
{
case
1
:
a++;
case
2
:
a++;
// is also executed at a value of a==1
case
3
:
a++;
// is also executed at a value of a==1 or a==2
}
In this example all three "a++" instructions are executed if a equals
1.
5.2.6.7
while
With a while instruction the instructions can depending on a condition be repeated in a loop.
while( Expression ) Instruction;
At first the Expression is evaluated. If the result is unequal
0
then the Expression is executed. After
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: ......