Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
While Statement
Use the while keyword to conditionally iterate a statement. The syntax of the while
statement is:
while expression do statement
statement
is executed repeatedly as long as 
expression
evaluates true. The test
takes place before the 
statement
is executed. Thus, if 
expression
evaluates false
on the first pass, the loop does not execute.
Here is an example of calculating scalar product of two vectors, using the while
statement:
s := 0; i := 0;
while i < n do
begin
s := s + a[i] * b[i];
i := i + 1;
end;
Probably the easiest way to create an endless loop is to use the statement:
while TRUE do ...;
169
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5