Do While Loop



Do While loop

Java 8
int count = 5;

do {
} while(count > 0);

The code inside the do-while block runs as long as the condition count > 0 evaluates to true.

The difference between do-while and while is that, in do-while the block is first run and then the condition is checked.

This means that no matter what do-while condition is, the block will always run at least once.

This will print 4 3 2 1 0 on Console.