Answer the question
In order to leave comments, you need to log in
How do I go to the previous menu?
Hello. Help the ignoramus. I need to implement a goto replacement, but I can't figure out how to do it through 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 item"
do {
Switch ($choice_1){
1{
Write-Host "1."
Write Host "2."
Write-Host "0. Previous menu"
Answer the question
In order to leave comments, you need to log in
better without the GOTO ideology,
but if not then:
there are such replacements
if you need to skip part of the actions in the nested loop from below, enter a variable and a sheet from IF
if you make a jump to the beginning of the loop then continue
if you need to go up one level of the loop then break
if there are more levels then you need to use break label
and multi-level menus are better implemented through a function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question