The for loop is the difinite loop, whose number of iterations are fixed. The code in the for loop is executed for a specified numbers of times. It is iterated over and over gain unless the number of iterations is satisfied.
Syntax for for loop
for(initilization; termination-condition; step(increment/decrement)){
//statements
}
Example
void main(){
var num = 6;
var factorial =1 ;
for( var i= num; i>=1; i--)
{
factorial *=1;
print(factorial);
}
}
The program code will produce the following output-
720