The while
command is a repeating structure with a condition at the beginning of the declaration.
Example:
while (condition) {
sentences to run
}
Already do... while
has verification at the end, ie, the repeat structure code runs at least once.
Example:
from { Loop Sentences
} while (condition)
We could implement do... while
using a while
loop. In this case, the part of the code that would be executed at least once would come above while
, following the logical sequence structure of the code.
Are there situations where we can only use do... while
?
What is the usefulness and importance of do... while
?