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
November 15, 2024 18:59
-
-
Save vexx32/65a6dad29a16fcc698645949c808540d to your computer and use it in GitHub Desktop.
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