The loop ( ) format is as follows.
For example,
loop (number of loops) //Defines the temporary
address that stores the number of loops.
{
[script expression]
break //Optional. Use to exit the loop partway
through.
} endloop // Defines the end of the loop.
(number of loops) Only a temporary Word Address
can be entered in the parentheses. (For example, loop
([t:000]))
"loop ( )" cannot be used in a trigger
equation.
The temporary Word Address value used to define
the number of loops decreases for every loop. When the value
changes to 0, the loop operation ends. If the temporary Word
Address value defined for the number of loops is modified, the loop
could become endless. The temporary Word Address used is designated
as Global. Therefore, simultaneously using this temporary Word
Address for other purposes could result in an infinite loop.
Until a loop operation completes, screen
displays of Parts and so on are not updated or refreshed.
loop ( ) can also be nested. When it is nested,
the "break" keyword will skip the innermost loop ( ).

If loop operation ends without using the escape
command, the temporary Word Address value becomes 0.
The range available for the temporary Word
Address value differs depending on the data format (Bin, BCD), bit
length, and code +/- used.If code +/- has been set and the
temporary Word Address becomes a negative value, the condition is
judged at the beginning of the loop and the loop processing
stops.
DO NOT use a PLC device in the loop formula.
Instead, use the display unit's internal user area devices or a
temporary work address.
For example, the following description performs data write to the
PLC many times in a short period (100 times in the following
example). This can cause a system error since communication
processing (the time required to write to the PLC) cannot be
performed at this speed.
For example,
[t:0000] = 100 //100 loops.
loop ([t:0000])
{
// Write to D0200.
[w:[PLC1]D0200] = [w:[#INTERNAL]LS0100]
// Increment LS0100.
[w:[#INTERNAL]LS0100] = [w:[#INTERNAL]LS0100] + 1
}endloop
Please change as follows:
[t:0000] = 100 //100 loops.
loop ([t:0000])
{
// Write to D0200.
[w:[#INTERNAL]LS0200] = [w:[#INTERNAL]LS0100]
// Increment LS0100.
[w:[#INTERNAL]LS0100] = [w:[#INTERNAL]LS0100] + 1
}endloop
// Write LS0200 content to D0200.
[w:[PLC1]D0200]=[w:[#INTERNAL]LS0200]
Using the keywords "loop" or "break" in
D-script function names will cause an error.