1. Overview
In this article, weβll look at a core aspect of the Java language β executing a statement or a group of statements repeatedly using a do-while loop.
2. Do-While Loop
The do-while loop works just like the while loop except for the fact that the first condition evaluation happens after the first iteration of the loop:
do {
statement;
} while (Boolean-expression);
Letβs have a look at a simple example:
int i = 0;
do {
System.out.println("Do-While loop: i = " + i++);
} while (i < 5);
3. Conclusion
In this quick tutorial, we explored Javaβs do-while loop.
