Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
WHILE STATEMENT
Use the while keyword to conditionally iterate a statement. The syntax of the while
statement is:
while expression
statements
wend
statements
are executed repeatedly as long as 
expression
evaluates true. The
test takes place before 
statements
are 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
s = s + a[i] * b[i]
i = i + 1
wend
Probably the easiest way to create an endless loop is to use the statement:
while TRUE
' ...
wend
157
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroBasic PRO for AVR
CHAPTER 5