0

Well, I have this problem with a little program that I'm making because my loop is endless. Right now I'm trying to use goto command but it doesn't work couse it is endless. Anyone please help.

@echo off
color 1a
:i
echo Hi, mate Let's start off by getting each others names.
timeout 5 > nul
echo What is your name ?: 
set /p name=
echo Hi noob %name% my name is Youke 
timeout 2 > nul
echo %name% We are going on an advenutre quest today :D
timeout 2 > nul
goto i
6
  • What's the code intention? What is the goto purpose? Commented May 15, 2014 at 17:06
  • The purpose of the goto is actually nothing it's something i wan't to try out on my programming skills in notepad. Commented May 15, 2014 at 17:09
  • 2
    If it has no purpose, why is it there? Your code loops endlessly because you told it to with the goto. Commented May 15, 2014 at 17:10
  • goto means " go to " ... Commented May 15, 2014 at 17:21
  • 2
    then why don't you ask so? for /L is your friend. Or if you want to do it "the hard way", use a counter and jump with if %count% lss 15 goto ... Commented May 15, 2014 at 17:38

1 Answer 1

1

Somewhere between the i label on line 3 and the goto command, you need to add code that will break out of the loop—likely an if statement with another goto inside it that points to a label after your current goto.

You can see plenty of examples here: https://stackoverflow.com/a/4711984/436282

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.