Having a hard time running my batch file.
I believe it has something to do with my if statements, it doesn't fall through.
I always end up with "if was unexpected at this time".
Please any help is grateful
:firstNumber
set /p "firstNum = Enter the first number (other than 22) "
if "%firstNum%"=="22" (
goto :end
) else (
goto :secondNumber
)
:secondNumber
set /p "secondNum = Enter the second number (other than 22 and 0) "
if "%secondNum%"=="22" (
goto :end
) if "%secondNum%"=="0" (
goto :errorNumber
) else (
goto :command
)
:errorNumber
echo You cannot divide by 0
goto :secondNumber
:command
set /a quotient=%firstNum% / %secondNum%
echo "%firstNum% divided by %secondNum% = !quotient!
:end
Aucun commentaire:
Enregistrer un commentaire