while Loop
noun
say it: “WHILE loop” /ˈwaɪl lup/
A loop that keeps repeating its code for as long as a condition stays true, checking the condition before each pass.
What is while Loop in Java?
while Loop — A loop that repeats while its condition remains true.
class Counter {
int countToThree() {
int number = 0;
while (number < 3) {
number++;
}
return number;
}
}
In a sentence
- “The game runs in a while loop until the player has no lives left.”
Level: Apprentice · More Java terms at this level
Updated