'GOTO Statements ' The command will force the program to go straight to a labeled location in the code. The ' statement following the GOTO command will not be executed. The next command will be the one at ' the specified line. The GOTO command must have a LABEL before it so it knows where to go back ' to. Look at the LABEL section for more example.
Sub display() Debug "You got the password right!", CR End Sub
Sub Main()
Dim x(2) As Short = {1,2,3}
Start: 'Label Debugin "Enter a 3 digit password", CR Debugin "Enter first digit", x(0), CR Debugin "Enter second digit", x(1), CR Debugin "Enter third digit", x(2), CR
If x(0) =1 And x(1) = 2 And x(2) = 3 Then display() Elseif x(0)=1 And x(1)=2 Then Debug "You got the first and second digit right", CR Elseif x(0)=1 And x(2)=3 Then Debug "You got the first and third digit right", CR Elseif x(1)=2 And x(2)=3 Then Debug "You got the second and third digit right", CR Elseif x(0)=1 Then Debug "You got the first digit right", CR Elseif x(1)=2 Then Debug "You got the second digit right", CR Elseif x(2)=3 Then Debug "You got the third digit right", CR End IF Goto Start 'GOTO Statement, the program loops back to the beginning. End Sub
|
|