Skip to content

Instantly share code, notes, and snippets.

@JustinGrote
Last active June 3, 2022 03:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save JustinGrote/90494428c5b9768cab89a450be74efbc to your computer and use it in GitHub Desktop.
Save JustinGrote/90494428c5b9768cab89a450be74efbc to your computer and use it in GitHub Desktop.
Reference Table for Loop Behavior in Powershell
Loop Return Continue Break
Normal Expectation NextItem NextItem ExitLoop
.foreach{} NextItem ExitLoop ExitLoop
foreach ($y in $x) ExitLoop NextItem ExitLoop
for ($i;$i -lt 5;$i++) ExitLoop NextItem ExitLoop
Foreach-Object -InputObject @() NextItem NextItem NextItem
Switch ExitLoop ExitLoop ExitLoop
While ExitLoop NextItem ExitLoop
@dgoldman-msft
Copy link

Love this! Great stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment