For loop

The for loop has the syntax:

for (<Init>; <Condition>; <Repeat>)
{
    <Statement list>
}

Init is a command before the loop begins, for example

$counter=0 A 

A Condition resolves to true or false and determines whether the loop runs.

Repeat executes every time the loop runs.

As a simple example...

for ($counter = 0; $counter -lt 10; $counter++)
{
    $counter
}

Last updated