What are the loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What are the loops

loops

27th Apr 2017, 8:57 AM
Hasnain Shabir
Hasnain Shabir - avatar
4 Answers
+ 8
something that happens more than once while ( alive == true) { breathe(); }
27th Apr 2017, 9:00 AM
jay
jay - avatar
+ 6
Rust: let dead: bool = false; loop { breathe(); if dead == true { break; //And, you died. What an unfortunate story. } }
27th Apr 2017, 2:03 PM
Complex
Complex - avatar
+ 3
loops are used to iterate / repeat statements number of times, for example if we have to print "hello world" 100 times, we can write the statement 100 times but it will be hard, so we can use loops to repeat the single statement 100 times and it will be easy and fast for us.
10th May 2017, 2:09 AM
Imran Hussain
+ 1
for i in range(5): breathe()
27th Apr 2017, 10:09 AM
LordHill
LordHill - avatar