+ 2
Why do we use loops in programming?
5 Respuestas
+ 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 👍
+ 2
https://code.sololearn.com/c33brQL54iaa/?ref=app
https://code.sololearn.com/cLHEsyp9TpS3/?ref=app
https://code.sololearn.com/c36uUv2G1FWw/?ref=app
https://code.sololearn.com/cdZXiqRZ7Woo/?ref=app
https://code.sololearn.com/c2RRMT78z6Gy/?ref=app
https://code.sololearn.com/cI1u5QkRLvr4/?ref=app
https://code.sololearn.com/coSf8B6mFDfC/?ref=app
+ 1
Examples
+ 1
loops are basically used in programming for program iteration and repetation of the conditional statement written inside it