Differentiat between do...While...Loop and do...Until...Loop
Answers
Answered by
8
Do {function} while/until(condition);
Both functions will execute the function in the do section, then look at te condition. Based off the condition, the program will either reexecute the function in the do brackets, or move on.
The difference between the two is that the do while loop will continue while the condition is true. The do until loop will continue while the condition is false.
Do while loops are exited after the first cycle if the condition is false, while do until loops are exited if the condition is true.
Both functions will execute the function in the do section, then look at te condition. Based off the condition, the program will either reexecute the function in the do brackets, or move on.
The difference between the two is that the do while loop will continue while the condition is true. The do until loop will continue while the condition is false.
Do while loops are exited after the first cycle if the condition is false, while do until loops are exited if the condition is true.
Answered by
7
do while loop is an entry controlled loop whereas do until loop is an exit con trolled loop.
in do while loop if the condition is false the loop does not get executed at all but in do until loop whether the condition is true or false it gets executed even once
Similar questions