The while loop executes the block when the condition is satisfied. Each time the condition is true the while loop is executed.
Syntax for while loop
while(expression){
//statements
}
Example
void main(){
var num = 6;
var factorial =1 ;
while( num i>=1)
{
factorial *=1;
print(factorial);
}
}
The program code will produce the following output-
720