Concept Flow - Difference between while and do–while
Start
Check condition
|Yes
Execute loop body
Repeat Check
No
Exit
Start
Execute loop body
Check condition
|Yes
Repeat Execute
No
Exit
The while loop checks the condition before running the code inside, so it may skip the loop if false. The do-while loop runs the code once before checking the condition, so it always runs at least once.