Perform automated and live-interactive testing on 3000+ real desktop and mobile devices online.
While Loop is a control flow statement that lets you execute code repeatedly until a given Boolean condition becomes true, the loop stops when the Boolean condition becomes false.
Syntax
while (condition) {
// code block to be executed
increment / decrement statement
}
Example
The below Java program prints numbers from 1 to 10.
class OneToFive {
public static void main(String[] args) {
int i = 1, k = 10;
while(i <= k) {
System.out.println(i);
i++;
}
}
}
Test your websites, web-apps, or mobile apps seamlessly with LambdaTest.
Start Free TestingEarn resume-worthy Selenium certifications that help you land a top job.
Learn MoreTest orchestration and execution cloud of 3000+ browsers and OS
24/7 support
Enterprise grade security
Fastest test execution cloud