What is Loop? Definition, Meaning & Example

A programming structure that repeats a block of code multiple times.

What is Loop? Definition, Meaning & Example

A programming structure that repeats a block of code multiple times.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: A programming structure that repeats a block of code multiple times.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

Loop: A programming structure that repeats a block of code multiple times.

Explanation

Loops automate repetitive tasks. For loops repeat a fixed number of times. While loops repeat while a condition is true. Do-while loops execute at least once then check condition. Loops help avoid code duplication. Nested loops occur when loops are inside loops. Loop control statements include break and continue.

Example

A for loop that counts from 1 to 10 and prints each number uses a loop to avoid writing 10 print statements.

Frequently Asked Questions

What are the main types of loops?

For loops, while loops, and do-while loops are main loop types.

What does a break statement do?

A break statement exits a loop immediately, useful for stopping iteration when a condition is met.

More Computer Terms

🤖 Stuck on any of these? Ask Syllab's free AI Tutor to explain step by step →