EasyManuals Logo
Home>Casio>Desktop>Z-1

Casio Z-1 User Manual

Casio Z-1
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #54 background imageLoading...
Page #54 background image
54
FOR-NEXT
PURPOSE: Executes the program lines between the FOR statement and NEXT
statement and increments the control variable, starting with the initial value.
Execution is terminated when value of the control variable exceeds the specified final
value.
FORMAT:
FOR
control variable
=
initial value
TO
final value
Numeric variable name
Numeric expression
Numeric expression
[ STEP
increment ]
Numeric expression
|
NEXT
[ control variable ]
[ ,
control variable
] *
Numeric variable name
Numeric variable name
EXAMPLE: FOR I=1 TO 10 STEP 0.1
|
NEXT I
PARAMETERS:
1. Control variable: numeric variable name. Array variables cannot be used.
2. Initial value: Numeric expression
3. Final value: Numeric expression
4. Increment: Numeric expression (default value = 1).
EXPLANATION:
1. None of the statements beyween FOR and NEXT are executed and the
program proceeds to the next executable statement after NEXT when the
initial value is greater than the final value.
2. Each FOR requires a corresponding NEXT.
3. FOR – NEXT loops can be nested (a FOR – NEXT loop can be placed inside
another FOR – NEXT loop). Nested loops must be structured as shown below
with NEXT appearing in inverse sequence of the FOR (e.g. FOR A, FOR B,
FOR C – NEXT C, NEXT B, NEXT A).
10 FOR I=1 TO 12 STEP 3
20 FOR J=1 TO 4 STEP 0.5
30 PRINT I,J
40 NEXT J
50 NEXT I
60 END
4. FOR NEXT loops can be nested up to 29 levels.
5. The control variable may be omitted from NEXT. However, use of the control
variable in the NEXT statement is recommended when using nested loop, to
make the code easier to understand.
6. NEXT statements can be chained by including them under one NEXT
statement, separated by commas.
10 FOR I=1 TO 12 STEP 3
20 FOR J=1 TO 4 STEP 0.5
30 PRINT I,J
40 NEXT J,I
50 END
P
0

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio Z-1 and is the answer not in the manual?

Casio Z-1 Specifications

General IconGeneral
BrandCasio
ModelZ-1
CategoryDesktop
LanguageEnglish

Related product manuals