Instructions
183 C-Control Pro IDE
© 2013 Conrad Electronic
If a loop needs to be programmed with a different step width Instruction2 needs to be modified ac-
cordingly:
for(i=0;i<100;i=i+3) // variable i does now increment in steps to 3
{
a=5*i;
}
break Instruction
A break instruction will leave the loop and the program execution starts with the next instruction
after the for loop.
continue Instruction
continue will immediately initialize a new calculation of the Expression. Depending on the result In-
struction2 will be executed at unequal 0 and the loop will repeat itself. A result of 0 will terminate the
loop.
Example:
for(i=0;i<10;i++)
{
if(i==5) continue;
}
4.2.6.4 goto
Even though it should be avoided within structured programming languages, it is possible with goto
to jump to a label within a procedure:
// for loop with realized with goto
void main(void)
{
int a;
a=0;
label0:
a++;
if(a<10) goto label0;
}