What is different between "while" and "do while" conditions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is different between "while" and "do while" conditions?

"while" first check the condition then do operation, while "do while" initially do operation just after that check the condition. So "do while" do action at least one time

28th Jun 2017, 3:19 PM
Абдурахим Илёсов
Абдурахим Илёсов - avatar
2 Answers
+ 1
- "do while" will first off all execute the statement in brackets, then check the condition in the "while" - "while will execute the statement only if the condition is verified! So u can have this exple: x=1; do { print("This the statement"; x++; }while(x>2) Even if the condition below is not true, the loop will output "This the statement" one time. but with "while', they will no be any output
28th Jun 2017, 3:45 PM
BenjiSolo
BenjiSolo - avatar
+ 2
in priorities
28th Jun 2017, 3:21 PM
Абдурахим Илёсов
Абдурахим Илёсов - avatar