Previous Topic: WHILE..WEND StatementsNext Topic: Functions


REPEAT..UNTIL Statements

A REPEAT..UNTIL statement contains a statement block. An expression controls repetitive runs by an expression.

The expression result must be of type Integer. The statement block runs repeatedly until the expression evaluates to true (nonzero).

This statement syntax is as follows:

REPEAT
statement block
UNTIL expression

Example: REPEAT … UNTIL statements

DIM FileName as String
DIM NoOfLines as Integer
DIM TmpLine as string
DIM hFile as Integer
FileName="C:\AUTOEXEC.BAT"
NoOfLines=0
hFile=OpenFile(FileName,0,0)
REPEAT
 ReadFile(hFile,TmpLine)
 NoOfLines=NoOfLines+1
UNTIL Eof(hFile)
CloseFile(hFile)
NoOfLines=NoOfLines-1
PRINT FileName + " Contains "+ str(NoOfLines) + " lines."
end: