Instructions

203 C-Control Pro IDE
© 2013 Conrad Electronic
Do
Instructions
Loop While Expression
The instructions are being executed. At the end the Expression is evaluated. If the result is unequal
0 then the execution of the expression will be repeated. The entire procedure will constantly be re-
peated until the Expression takes on the value 0.
Examples:
Do
a=a+2
Loop While a<10
Do
a=a*2
x=a
Loop While a
The essential difference between the Do Loop While loop and the normal Do While loop is the
fact that in a Do Loop While loop the instruction is executed at least once.
Exit Instruction
An Exit instruction will leave the loop and the program execution starts with the next instruction after
the Do Loop While loop.
Example:
Do
a=a+1
If a>10 Then
Exit ' Will terminate loop
End If
Loop While 1 ' Endless loop
4.3.6.2 Do While
With a while instruction the instructions can depending on a condition be repeated in a loop:
Do While Expression
Instructions
End While
At first the Expression is evaluated. If the result is unequal 0 then the expression is executed. After
that the Expression is again calculated and the entire procedure will constantly be repeated until the
Expression takes on the value 0.
Examples: