in do - while loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

in do - while loop

what does it mean : while(true) , while(false) in do - while loop??

29th Jun 2016, 9:42 PM
Abdelrhman Mansour
Abdelrhman Mansour - avatar
3 Answers
+ 1
It's trying to say that whilst a condition is true, the code will repeat over and over again until the condition is false. Example: 3 <10 =true that's because 3 is less than 10 so.... while(3 <10){ //The code in here will run over and over until the //condition in the while loop (3 <10) is false. document.write ("Hello World!!!"); } Hope it helped :)
30th Jun 2016, 3:51 AM
Cocoa
Cocoa - avatar
+ 1
What Cocoa said. BUT! A do while loop ALWAYS runs once.
30th Jun 2016, 5:01 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
0
while(true) in do-while loop, doesn't stop until a break statement! but while(false) in do-while loop, runs only for once...
6th Jul 2016, 8:48 AM
Ali Rahmani fard
Ali Rahmani fard - avatar