What is the differences between while loop and do-while loop?


1 Answers

Yo Kass Profile
Yo Kass answered

A do-while loop will always run at least once.

It executes a block of code, and then loops over it or not - depending on the evaluation of a condition at the end of the code block.

A while loop checks the condition at the top of the code block, so might never run through the loop if the condition is not met.

Answer Question