do ... while loop
suggest changevar availableName;
do {
availableName = getRandomName();
} while (isNameUsed(name));
A do while
loop is guaranteed to run at least once as it’s condition is only checked at the end of an iteration. A traditional while
loop may run zero or more times as its condition is checked at the beginning of an iteration.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents