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 statement block runs and the expression is evaluated. The expression result must be of type Integer. The statement block runs repeatedly until the expression evaluates to true (nonzero).

This statement has the following syntax

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: