11 - 401 11 - 401
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
FOR to TO
WEND
NEXT
WHILE
:
(Incorrect)
(Correct)
NEXT
WEND
WHILE
:
FOR to TO
If the WHILE to WEND instructions are used in combination with the FOR to NEXT
instructions, take precautions so that the inner loop is completely contained
within the outer loop.
Program Example
10 ' This program repeats a calculation while the specified condition holds
20 I=1
:
' Sets the initial value
30 WHILE I<10
:
' Repeats until I exceeds 10
40 PRINT "I=":I
:
' Displays the values of I
50 I=I+1
:
' Adds 1 to I
60 WEND
70 PRINT "I exceeded 10"
:
' Displays the result
80 END
RUN
I=1
I=2
I=3
I=4
I=5
I=6
I=7
I=8
I=9
I exceeded 10
OK
REMARK
See the FOR to NEXT instructions and Section 3.6.4.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...