Loops in Java: Meet the While Loop
In Java, loops are used to repeat a block of code as long as a certain condition is true. One of the simplest types of loops is the while
loop.
The Syntax
while (condition) {
// code to repeat
}
As long as the condition is
true
, the code inside the loop keeps running.
No comments:
Post a Comment