While Loop #
The while
loop runs a block of code repedadly as long as the while
condition is true
.
int i = 0;
while (i < 10) {
System.out.println(i);
i++;
}
The code above will loop until i
is not less than 10. The code would loop undefinatly if the while
condition was set
always true
.