Loop | Return | Continue | Break |
---|---|---|---|
Normal Expectation | Exit Scope | Next Item | Exit Loop |
.foreach{} | Next Item | Break Scopes / Next Item of Parent Loop | Break Scopes / Exit Parent Loop |
foreach ($y in $x) | Exit Scope | Next Item | Exit Loop |
for ($i;$i -lt 5;$i++) | Exit Scope | Next Item | Exit Loop |
Foreach-Object -InputObject @() | Next Item | Break Scopes / Next Item of Parent Loop | Break Scopes / Exit Parent Loop |
Switch | Exit Scope | Next Item | Exit Switch |
While | Exit Scope | Next Item / Iteration | Exit Loop |
Forked from JustinGrote/PowershellLoopBehavior.md
Last active Jan 15, 2022
Reference Table for Loop Behavior in Powershell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment