Example
LET F = FILEEOF 2
sets variable F to 1 or 0 depending on whether the end of file 2 has been reached or not.
4.8 Loops, Conditionals and Program Flow
4.8.1 FOR..NEXT loop structures
The FOR..NEXT loop structure is useful where you want to run a certain block of statements
several times. A variable is used as the counter.
Syntax:
FOR <variable> = <expression> TO <expression>
<Statements>
NEXT
For example:
FOR A = 1 TO 5
PRINT A
NEXT
Running this program simply loops through the statement (PRINT statement, in this case) 5 times,
and prints the value of the loop variable A to the terminal each time. The result on the terminal
screen is:
1
2
3
4
5
Indentation is not important, it is ignored by the compiler and is only useful to make the program
more human-readable.
FOR..NEXT statements may also be nested. For example:
FOR A = 1 TO 4
FOR B = 1 TO 3
PRINT A, B
NEXT
NEXT
This prints the following to the terminal:
1 1
1 2
1 3
U4B operating manual Rev 1.00
33
Содержание U4B Ultimate4
Страница 54: ...U4B operating manual Rev 1 00 54...