+ 1

What's the difference of the while loop and the do ... while loop?

19th Jun 2017, 6:53 PM
Armo03
4 Respostas
+ 5
in a while loop the program will only execute if the condition is met. in a do while loop the program will enter the loop atleast once no matter what and will repeat the loop while the condition is met. so basically while loop might not get executed at all while the do while loop will get executed atleast once
19th Jun 2017, 6:58 PM
Mark Lesniak
Mark Lesniak - avatar
+ 3
The do while loop will execute the loop body once even if the condition is not true
19th Jun 2017, 6:56 PM
Louis
Louis - avatar
0
in while loop from the beginning it will start to check its condition and in do –while loop 1st time it will allow to execute than it will start to check its condition.
19th Jun 2017, 7:43 PM
MD. WOALID HOSSAIN
MD. WOALID HOSSAIN - avatar
0
The do while loop executes the statements inside the code block and then checks if the condition is met. The condition is also terminated by a semicolon. The while loop checks the if the condition is met and then execute whats inside the code block. The condition is not terminated by a semicolon.
21st Jun 2017, 3:54 AM
Herlem A. Martinez
Herlem A. Martinez - avatar