
Section 9. Program Control Instructions
contains only processing tasks, these tasks can run in conjunction with the
main scan.
While…Wend
The While…Wend instructions are used to executes a series of statements in a
loop as long as a given condition is true.
Syntax
While Condition
[StatementBlock]
Wend
Remarks
While…Wend loops can be nested.
The While...Wend statement has the following parameters:
While The While statement begins the While...Wend loop control
structure.
Condition The Condition is any expression that can be evaluated True
(nonzero) or False (0 and Null). If Condition is true, all
statements in StatementBlock are executed until the Wend
statement is encountered. Control then returns to the While
statement and Condition is again checked. If Condition is
still true, the process is repeated. If Condition it is not True,
execution resumes with the statement following the Wend
statement.
StatementBlock The StatementBlock is the portion of the program that
should be repeated until the loop is terminated. These
instructions lie between the While and Wend statements.
Wend The Wend statement ends the While...Wend control
structure.
The Do...Loop provides another way to perform looping.
NOTE
While...Wend Statement Example
This example creates a While...Wend that is exited only if Reply is within a
range.
Dim Reply 'Declare variable.
While Reply < 90
Reply = Reply + 1
Wend
9-21
Commentaires sur ces manuels