Goto isnt working within a IF statement but other lines are working

31 views Asked by At
if NumberOfIncorrectLetters = 13 Then
    GraphicsWindow.PenColor="white"
    HangmanPart13 =  Shapes.AddRectangle(40,5)
    Shapes.Move(HangmanPart13,1133,575)
    GraphicsWindow.DrawBoundText(1000,900,500,"You Lost, the word was : " + WordYouNeedToGuess)                       
  
    NumberOfIncorrectLetters = 0
  
    Goto Start

This is the IF statement, the other lines work but I can't use goto to restart my hangman game. I want to run the script from a point just below the top but dont know any other ways.

1

There are 1 answers

0
Eng. M.Hamdy On

You should define a label to use goto to jump to. The label is just an identifier name followed by :

Start:

Note that you can't jump out of a subroutine.