Continue
suggest changeThe Continue operator works in For, ForEach, While and Do loops. It skips the current iteration of the loop, jumping to the top of the innermost loop.
$i =0
while ($i -lt 20) {
$i++
if ($i -eq 7) { continue }
Write-Host $I
}
The loop writes 1 through 19 and skips 7. The condition is $i -lt 20, so 20 is not written.
Note: Inside ForEach-Object, return exits only the current script block, so the pipeline continues with the next object. continue looks for an enclosing loop instead.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents