Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Labels
Labels serve as targets for goto statements. Mark the desired statement with a label
and colon like this:
label_identifier : statement
Before marking a statement, you must declare a label. Labels are declared in dec-
laration part of unit or routine, similar to variables and constants. Declare labels
using the keyword 
label:
label label1, ..., labeln;
Name of the label needs to be a valid identifier. The label declaration, marked state-
ment, and goto statement must belong to the same block. Hence it is not possible
to jump into or out of a procedure or function. Do not mark more than one statement
in a block with the same label.
Here is an example of an infinite loop that calls the Beep procedure repeatedly:
label loop;
...
loop: 
Beep;
goto loop;
Note: label should be followed by end of line (CR) otherwise compiler will report an error:
label loop;
...
loop: Beep; // compiler will report an error
loop: // compiler will report an error
138
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5