-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
16 lines (11 loc) · 859 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
title: Loop
slug: Glossary/Loop
page-type: glossary-definition
---
{{GlossarySidebar}}
A **loop** is a sequence of instructions that is repeated until a certain condition is met. An example would be the process of getting an item of data and changing it, and then making sure some {{Glossary("conditional", "condition")}} is checked — such as if a counter has reached a prescribed number.
Loops are one way to execute a statement for a variable number of times. The same effect can be achieved with {{glossary("Recursion", "recursion")}}, especially in languages where all data is {{glossary("Immutable", "immutable")}}, making it impossible to update a counter variable.
## See also
- [Control flow](https://en.wikipedia.org/wiki/Control_flow#Loops) on Wikipedia
- [Loops and iteration guide](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration)