SoFunction
Updated on 2025-04-09

A brief summary of Powershell's break, continue and return

There are two special keywords in Powershell, which are break and continue in the loop.

Look at this "continue", the continuation in the loop is to skip the remaining code. When you use a "break", the loop will end early but will return all current results.

In addition, the keyword "return" will immediately exit the current scope. So when you execute "return" in the function, the function will end, and when you execute "return" in the script, the script will end.