about Break - PowerShell | Microsoft Learn
Do not use break outside of a loop, switch, or trap See also Short description Describes a statement you can use to immediately exit foreach, for , while, do, switch, or trap statements. Long description The break statement provides a way to exit the current control block. Execution continues at the next statement after the control block.