+ 2
What is the difference between while and do while statements
4 odpowiedzi
+ 10
You can find your answer here
https://techdifferences.com/difference-between-while-and-do-while-loop.html
+ 5
"while" is pre - test, it check the condition first before executing the inside code , while the "do while" is post - test that it execute the code first then check the condition.
+ 3
while loop first check the condition then execute the code inside the loop
do while first execute the code inside the loop then check the condition
So do while execute once even the condition is false
+ 2
x = 1
example:
while(x > 2){
display "hello"
}
output : (no ouput) because the condition is already false
do
{
dipslay "hello"
} while(x > 2)
output : hello