Explain the working of while loop with example
Answers
Answered by
3
A while loop will continue incrementing until the condition given is false.
Example:
int x = 5;
while (x >= 3) {
System.out.println(x);
x--;
}
In this case, the above code will execute 3 times before the statement becomes false.
Similar questions