The Condition consists a word, either while or until, followed by a numeric expression. Each time through the loop, the numeric expression is evaluated and the looping continues while the expression is true, if the word while appears, or until the expression is true, if the word until appears. If the result of the evaluation requires the loop to be terminated, execution proceeds with the statement following the loop statement.
The Condition may appear on either the do statement or the loop statement, but not both. The Condition may be omitted from both statements, which produces an infinite loop: the loop is never terminated (except by other means).
If the Condition appears on the do statement, then the numeric expression is evaluated "at the top of the loop" and if the Condition appears on the loop statement, then the numeric expression is evaluated "at the bottom of the loop." Logically, these scenarios are virtually identical: in either case, the expression is evaluated between iterations of the loop statements. The difference occurs only when control is transferred to the do statement the first time (rather by looping from the loop statement). Then the difference appears as which occurs first: the evaluation of the expression or the execution of the loop statements. If the Condition is placed on the do statement, then the expression is evaluated first. If the Condition is placed on the loop statement, then the loop statements are executed first.
It is worth noting that if the Condition uses the word while and appears on the do statement, then this functions the same as the while...wend statement, if the numeric expression is the same.
The purpose of the following example is to show how the structure that is a comma separate list might be represented (indeed embedded) in the control structure of a program, called a parser:
do ltype = usrlex if ltype <> ITEM then_ print "syntax error" call storeitem ltype = usrlex while ltype = COMMAAt the end of this loop, one addition token will have been read, and its type stored in "ltype".
from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber