do while Loops

When you require a loop to iterate at least once before any tests are made, use a do…while loop, which is similar to a while loop, except that the test expression is checked only after each iteration of the loop. So, to output the first seven results in the seven times table, you could use code such as that in Following Example.

count = 1
document.write(count + " times 7 is " + count * 7 + "<br />")
} while (++count <= 7)