What Is a Loop in Computer Programming?


In programming, a loop is a set of repeated instructions that continues for a specified number of times or until a condition terminates the process. Programming loops provide a method to complete repetitive processes without writing the code multiple times.

All high-level programming languages provide different loop methods. Examples include forwhile, and do-while loops. Some programming languages provide functions to terminate loops, such as break and continue statements.

A specific case of programming loops is an infinite loop, which does not have a specified number of executions and continues until a terminating condition.