While...Wend
Positron16 · Revision 1.1.3.5 · PDF page 325
Syntax
While Condition Instructions Instructions Wend
or
While Condition { Instructions } : Wend
or
While Instructions Instructions Wend
Overview
Execute a block of instructions while a condition is true, unless no condition is placed after While, in which case and infinite loop will be created.
Example
MyVar = 1
While MyVar <= 10
Print Dec MyVar, " "
MyVar = MyVar + 1
Wend
or
While PORTA.0 = 1 : Wend ' Wait for a change on the Port
or
MyVar = 1
Do
Print at 1,1, Dec MyVar, " "
MyVar = MyVar + 1
Loop
Notes.
While-Wend, repeatedly executes Instructions While Condition is true. When the Condition is no longer true, execution continues at the statement following the Wend. Condition may be any comparison expression. If not condition is placed after While, an infinite loop will be created. A no condition While-Wend is only valid when both are on a separate line.
See also : If..Then..ElseIf..Else..EndIf, Repeat…Until, For…Next.
