+ 1
What's the difference of the while loop and the do ... while loop?
4 odpowiedzi
+ 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
+ 3
The do while loop will execute the loop body once even if the condition is not true
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.
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.