The primary logic in a program, which is input-process-output and repeat. The main loop continually tests for input and calls the appropriate routines to process it. Outputs are updated files sent to storage or the network as well as the data sent to a screen or printer.
The following illustrations are simplified examples of the common interactive program people use all the time and batch programs, which go from start to finish without user intervention. See
loop and
event loop.
Interactive Processing Program Loop
Almost every program users work with today are interactive, and the primary loop is always testing for a mouse click, keyboard entry or network input.
Batch Processing Program Loop
In a batch processing program where data are processed without human interaction, the main loop reads the next record and processes it. See
loop.