Using the while loop should include a statement that will continue executing a block of statements for the duration a Boolean expression remains true. The expression is evaluated at the top of the loop. Sample code follows:

while (Boolean expression) {
    statement(s)
}

Using the do-while statement should loop over a block of statements while a Boolean expression remains true. The expression is evaluated at the bottom of the loop, so the statements within the "do-while" block execute at least once. Sample code follows:

do {
    statement(s)
} while (expression);