DEV Community

Arul .A
Arul .A

Posted on

What is while loop?

  • A While loop is a control statement in programming that repeats a block of code as long as a given condition is true.

SYNTAX:

while(condition){
}
Enter fullscreen mode Exit fullscreen mode

EXAMPLE:

i=1;
while(i<=5){
console.log(i);
i++;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)