Repeat
While Loop
Java
int count = 5;
while (count > 0) {
count--;
System.out.println(count);
}
The code inside the while
block runs as long as the condition count > 0
evaluates to true.
This will print 4 3 2 1 0 on Console.
int count = 5;
while (count > 0) {
count--;
System.out.println(count);
}
The code inside the while
block runs as long as the condition count > 0
evaluates to true.
This will print 4 3 2 1 0 on Console.