FOR loop using Structured Text- IEC-61131-3
Loops are important to do repeated tasks, instead of rewritting the same instruction over and over again. It works by defining a counter, "i" in our case, which will count in a certain range, 0 to 10 in our case. with every count, the operation inside the two curly brackets will be excuted once, then the "i" counter will be increased,until we reach our target coutner value, 10 in our case.
//structured Text Variable Declaration
i : INT;
value : INT:=0;
//For loop example
FOR i := 0 TO 10 DO
value:= value + 1; //accumulate value every itiration
END_FOR;