How to make the transition to the previous menu?

Hi all. Help the ignorant. I need to implement the replacement of goto, but can't figure out how to do it using do
I have this structure

do {
Write-Host "1."
Write-Host "2."
Write-Host "3."
Write-Host "4."
Write-Host "5."
Write-Host "0.Exit"
Write-host
$choice1 = Read-Host "Select menu"

do {
Switch ($choice_1){
1{
Write-Host "1."
Write-Host "2."
Write-Host "0. Previous menu"
$choice_action = Read-Host Action
Switch ($choice_2)
{1{}
2{}
0{}
}
}
5{find_user}
0{breake}
}

} until ($choice_2 = 0)
} until ($choice_1 = 0)
exit

Here to realize a return to the initial menu, choice_1
With this design at iteration turns out to cause menu, choice_2, but to go on choice_1 not out.
Tell me what to do, what may I once shoved.
Thank you
July 9th 19 at 10:13
1 answer
July 9th 19 at 10:15
Solution
better without ideology GOTO
but if you did then:
there are replacement
if you need to miss part of the action in the nested loop at the bottom to enter a variable and a sheet of IF
if you do jump to the beginning of the cycle then continue
if you need to move up a level cycle to break
if the levels are larger you have to use break label
a multi-level menu is better implemented through the function
thank you. tomorrow I will try. I thought that ps does not work goto - Clyde58 commented on July 9th 19 at 10:18
: simply no, the only way unconditional branch break through - catalina_Sawa commented on July 9th 19 at 10:21
not much I do not understand how to apply it. I thought to slip it into a do loop, but something did not work - Clyde58 commented on July 9th 19 at 10:24
: I'm sorry, head is a mess of different languages, break in powersale works differently than yesterday I described - catalina_Sawa commented on July 9th 19 at 10:27
: thank you very much. removed all the body and now from the inside cause its the same. works fine - Clyde58 commented on July 9th 19 at 10:30

Find more questions by tags PowerShellWindows ServerWindows