Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WHILE...WEND Statement Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
WHILE condition
statementblock
WEND
Usage Notes
■ If condition is true - that is, if it does not equal zero - then any
intervening statements are executed until the WEND statement is
encountered. Visual Basic then returns to the WHILE statement and
checks the condition. If it is still true, the process is repeated. If
condition is not true or equals zero, execution resumes with the
statement following the WEND statement.
■ WHILE...WEND loops can be nested to any level. Each WEND matches the
most recent WHILE. When Visual Basic encounters an unmatched WHILE
statement, it generates the error message, "WHILE without WEND." If
Visual Basic encounters an unmatched WEND statement, it generates the
error message, "WEND without WHILE."
■ Do not branch into the body of a WHILE...WEND loop without executing a
WHILE statement. Doing so may cause run-time errors or program logic
errors that are difficult to locate.