Hello,
I am new here and here is my my problem. I want to jump back and forward between "labels" that i defined. I go and get back from the ":Kitchen" but other are not working. What am i missing?
:Corridor
echo -------: Kitchen
echo -------: Restroom
echo -------: Freezer
set /p LOOK=LOOK :
if %LOOK%==Kitchen (goto :Kitchen) else (goto :Corridor)
if %LOOK%==Restroom (goto :R2) else (goto :Corridor)
if %LOOK%==Freezer (goto :R3) else (goto :Corridor)
Pause >nul
:Kitchen
echo Kitchen
set /p Back= Type Back to turn corridors :
if %Back%==Back (goto :Corridor) else (goto :Kitchen)
Pause
:Restroom
echo Restroom
set /p Back= Type Back to turn corridors :
if %Back%==Back (goto :Corridor) else (goto :Restroom)
Pause
:Freezer
echo Freezer
set /p Back= Type Back to turn corridors :
if %Back%==Back (goto :Corridor) else (goto :Freezer)
Pause
Stuck on if else
Moderator: DosItHelp
Re: Stuck on if else
Code: Select all
if "%LOOK%"=="Kitchen" (
goto :Kitchen
) else if "%LOOK%"=="Restroom" (
goto :R2
) else if "%LOOK%"=="Freezer" (
goto :R3
) else goto :Corridor
But where are the labels :R2 and :R3 you want to jump to?
FWIW With all those GOTO criss-crossing you will lose track of the code quite soon.
Steffen