Why do we use loops in programming? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why do we use loops in programming?

13th Dec 2021, 2:24 PM
Jaspreet Singh
Jaspreet Singh - avatar
5 Answers
+ 10
One word - repetition. Whenever we need to do something many times, or we need to work with some data container (e.g. an array) we use loops. For example we can use a loop when we want to print a welcome message on screen 3 times. Instead of writing 3 sets of print statements, we use loop for the purpose, and be fine. Play with the examples in the lessons to better understand 👍
13th Dec 2021, 2:51 PM
Ipang
+ 1
Examples
13th Dec 2021, 4:55 PM
Atul [Inactive]
+ 1
loops are basically used in programming for program iteration and repetation of the conditional statement written inside it
20th Dec 2021, 9:04 AM
Yamima Thapa
Yamima Thapa - avatar