Implementing Tight Loops
Almost every program, regardless of whether it is a PLC program or a normal application, will loop in some fashion. If a PLC program did not loop, it would be relatively worthless because unless the operators had near-perfect timing for starting an operation, the program would almost immediately stop. Even if the operator did manage to kickstart a run, as soon as the program reached its final command, it would stop. Without some type of loop, a PLC program would be relatively useless.
PLCs will often implement a loop that will iterate over a program and prevent the PLC program from needing to be restarted. However, programmers will often need loops to be a bit more specific. More specifically, a programmer will often need to create a loop to loop over a smaller portion of code in the PLC program until a condition is met.
In programming, there are many different types of loops. Each type of loop will have its own applications and optimization for certain...