bas7advr.hlp (Topic list)
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
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
WHILE...WEND executes a series of statements in a loop, as long as a given
condition is true.
 
WHILE condition
.
.
.
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. BASIC then returns to the WHILE statement and checks
      the condition. If it is still true, the process is repeated. If
      it is not true (or if it 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 BASIC encounters an unmatched WHILE
      statement, it generates the error message, "WHILE without WEND."
      If 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 the WHILE. This can cause run-time errors or program
      problems that are difficult to locate.
    ■ BASIC's DO...LOOP statement provides a more powerful and flexible
      loop control structure.