For Loop In Dart

This is the most common type of loop. You can use for loop to run a code block multiple times according to the condition. The syntax of for loop is

for(initialization; condition; increment/decrement){
            statements;
}
  • Initialization is executed (one time) before the execution of the code block.

  • Condition defines the condition for executing the code block.

  • Increment/Decrement is executed (every time) after the code block has been executed.

void main()
{
    for (int i = 1; i <= 10; i++) 
    {
        print(i);
    }
}