Loop

noun

say it: “LOOP” /luːp/

Code that repeats a block of steps, a set number of times, until something changes, or once for each item.

What is a loop?

A loop repeats a block of code. A for loop repeats a set number of times ("do ten push-ups"), a while loop repeats until something changes ("stir until it thickens"), and a for-each loop visits every item in a collection ("greet everyone in line"). Every data structure in this course is walked through with a loop.

In a sentence

  • “A loop walks through every snack on the list and adds up the stock.”

Level: Novice · More Software Development terms at this level

Updated

In other subjects