WHILE ... END WHILE
WHILE expr
[ BREAK ]
[ CONTINUE ]
[ EXIT WHILE ]
{ statement }
[ELSE
{ statement } ]
END WHILE | WEND
While repeats a loop until the test conditions are met. Break exits the loop immediately, and Continue jumps to the top of the loop.
If the While statement is exited without executing a Break, the optional Else statement will be executed.
' Search a file for a matching string
WHILE NOT EOF()
INPUT #1, text
IF instr( text, matchingText ) THEN
PRINT "Found the text"
BREAK
END IF
ELSE
PRINT "Text not found"
END WHILE