PowerShell Loops For


Example

for($i = 0; $i -le 5; $i++){
    "$i"
}

A typical use of the for loop is to operate on a subset of the values in an array. In most cases, if you want to iterate all values in an array, consider using a foreach statement.