
7-6
Section
Details of BASIC Commands
159
for to step / next
Syntax:
FOR
<variable> = <numeric expression 1>
TO
<numeric expression 2> [
STEP
<numeric expression
3>] (: | <end-of-line>) <program>
NEXT
<variable> {,<variable>}
Description:
Statement. Allows the program segment between the
FOR
and the
NEXT
statement to be repeated a
number of times.
Remarks:
The
FOR
statement specifies the beginning of the loop and the
NEXT
statement specifies the end of
the loop. The loop is executed a specified number of times depending on the value of the
expressions in the
FOR
statement.
<Variable> is used as a counter and is incremented by the amount specified by <numeric
expression 3> after the
STEP
statement each time the loop is executed. The initial value of the
variable is equal to <numeric expression 1> in the
FOR
statement. The execution of the loop
terminates when the value of <variable> surpasses that of <numeric expression 2> defined after
the
TO
statement.
If the
STEP
increment is zero the loop is executed indefinitely.
If the initial value of the variable is greater than the
TO
value then the increment specified must be
negative. If not, then the loop is never executed.
The
NEXT
statement can be used to terminate more than one
FOR
loop by specifying more than
one loop counter variable. For instance if two nested loops terminate at the same point then one
NEXT
statement specifying both variables can be used. Care must be taken to terminate nested
loops in the correct order.
Example :
10
FOR A
= 1
TO
10
20
FOR B
= 1
TO
10
30
PRINT A
,
B
40
NEXT B
,
A
The variable(s) used in the
NEXT
statement must correspond to that used in the
FOR
statement(s)
Examples:
> 10 FOR A=1 TO 3
> 20 PRINT A
> 30 NEXT A
> RUN
1
2
3
See also:
WHILE
/
WEND
fre
Syntax:
FRE
Description:
System Variable. Reports amount of free user memory .
FRE
is a read-only system variable; it cannot be assigned a value. The result is the amount of
available user memory, in bytes.
Remarks:
Note:
1.
The result is the total user memory available, there is no differentiation between
program and data memory areas.
Examples:
> 10 PRINT “THE FREE USER MEMORY IS “; FRE; “ BYTES”
> RUN
THE FREE USER MEMORY IS 204656 BYTES.
See also:
Содержание C200H-ASC11
Страница 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Страница 2: ...iv...
Страница 4: ...vi...