The foreach loop executes against each element of a collection using the following notation:
foreach (<element> in <collection>) { <body-statements> }
For example, the foreach loop may be used to iterate through each of the processes returned by Get-Process:
foreach ($process in Get-Process) { Write-Host $process.Name }
If the collection is $null or empty, the body of the loop will not execute.