Datasheet
for (..;..;..) {
...
if (val>0) continue;
...
// continue jumps here
}
GOTO STATEMENT
The goto statement is used for unconditional jump to a local label — for more infor-
mation on labels, refer to Labeled Statements. The syntax of the goto statement is:
goto label_identifier ;
This will transfer control to the location of a local label specified by label_identi-
fier
. The label_identifier has to be a name of the label within the same func-
tion in which the goto statement is. The goto line can come before or after the label.
goto is used to break out from any level of nested control structures but it cannot be
used to jump into block while skipping that block’s initializations – for example, jump-
ing into loop’s body, etc.
The use of goto statement is generally discouraged as practically every algorithm can
be realized without it, resulting in legible structured programs. One possible application
of the
goto statement is breaking out from deeply nested control structures:
for (...) {
for (...) {
...
if (disaster) goto Error;
...
}
}
.
.
.
Error: /* error handling code */
216
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroC PRO for AVR
CHAPTER 5