
Example
DataCount% = TRANSACTION_COUNT
FOR Counter% = 1 TO DataCount%
Data$ = GET_TRANSACTION_DATA$(Counter%)
HostCommand$ = READ_COM$(1)
IF HostCommand$ = "STOP" THEN EXIT
WRITE_COM(1,Data$)
NEXT
FOR ... NEXT
Purpose
To repeat the execution of a block of statements for a specified number of times.
Syntax
FOR N% = startvalue TO endvalue [STEP step]
[Statement Block]
NEXT [N%]
Remarks
"N%" is an integer variable to be used as a loop counter.
"startvalue" is a numeric expression which is the initial value for the loop counter.
"endvalue" is a numeric expression which is the final value for the loop counter.
"step" is a numeric expression to be used as an increment/decrement of the loop
counter The "step" is 1 by default.
If the loop counter ever reaches or beyond the endvalue, the program execution
continues to the statement following the NEXT statement. The Statement block will
be executed again otherwise.
Example
DataCount% = TRANSACTION_COUNT
FOR Counter% = 1 TO DataCount%
Data$ = GET_TRANSACTION_DATA$(Counter%)
WRITE_COM(1,Data$)
NEXT
WHILE ... WEND
Purpose
To repeat the execution of a block of statements while a certain condition is TRUE.
Syntax
WHILE condition
[Statement Block]
WEND
Comentarios a estos manuales