Creating a subloop

Hi , Instead of placing all my code in the main loop, I wanted to create a SUBLOOP . Then call the subloop from the main loop.
For example in Winbatch, I could call a subloop with “GoSub” and use the “Return” statement to return back to the main loop.
How would I do something similar in Powershell?

Thanks
Hil

I use foreach within a foreach.
Is that what you’re looking for ?

You’re probably looking for:

Do {} until ($something -eq "something")

But without a sample code, is a bit hard to determine your scenario.

The nearest thing to your description is to create a function and call that. I’d suggest very strongly that you take the time to investigate how PowerShell works - if you just port over the way you do things in other languages you can end up with very inefficient code