Lably
Skip to content

Loop (statement)

Control flow construct for executing code repeatedly

  • 8 min read
  • 7 chapters

Learn it on Lably

Overview

Loops are a feature of high-level programming languages. In low-level programming languages the same functionality is achieved using jumps. When a program is compiled to machine code, looping may be achieved using jumps; but some loops can be optimized to run without jumping.

Usually, loops are expected to run for a finite number of iteration. Without proper care, loops may accidentally be created that have no possibility of terminating. Such loops are called infinite loops. The problem of determining whether a program contains an infinite loop is known as the halting problem.

Sign in to keep reading

6 more chapters are free with a Lably account.

More in Computing and communication