Mitsubishi QD51 Programming Manual page 241

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
If the nested loops have the same end point, multiple variable names can be described
following one NEXT instruction.
However, list variable names in the order starting from the one that corresponds to the
closest FOR instruction.
FOR I=0 TO 10
FOR J=0 TO 10
to
NEXT J, I
• A "NEXT without FOR" error occurs if the NEXT instruction without the corresponding FOR
instruction is detected.
Program Example
10 ' Makes a multiplication table
30 FOR I=1 TO 9
40 FOR J=1 TO 9
50 PRINT USING "####";I*J;
60 NEXT J
70 PRINT
80 NEXT I
90 END
RUN
1
2
2
4
3
6
4
8
5
10
6
12
7
14
8
16
9
18
OK
11 - 71
3
4
5
6
7
6
8
10
12
14
9
12
15
18
21
12
16
20
24
28
15
20
25
30
35
18
24
30
36
42
21
28
35
42
49
24
32
40
48
56
27
36
45
54
63
REMARK
See the ERASE and WHILE to WEND instructions, and Section 3.6.3.
:
' Repeats with I=1 to 9
:
' Repeats with I=1 to 9
:
' Displays the value of I*J
:
' New line
8
9
16
18
24
27
32
36
40
45
48
54
56
63
64
72
72
81
MELSEC-Q
11 - 71

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents