Code: Select all
alldigit: PRINT "Do you want to use all digits?"
INPUT "Press Y or N and ENTER", alldigit$
IF alldigit$ <> "Y" and alldigit$ <> "N" THEN PRINT "ERROR":GOTO alldigit
How can I avoid using GOTO and a line label?
Moderators:Administrator, Global Moderator
Code: Select all
alldigit: PRINT "Do you want to use all digits?"
INPUT "Press Y or N and ENTER", alldigit$
IF alldigit$ <> "Y" and alldigit$ <> "N" THEN PRINT "ERROR":GOTO alldigit
How can I avoid using GOTO and a line label?
Code: Select all
alldigit: PRINT "Do you want to use all digits?"
INPUT "Press Y or N and ENTER", alldigit$
IF alldigit$ <> "Y" and alldigit$ <> "N" THEN PRINT "ERROR":GOTO alldigit
Code: Select all
WHILE alldigit$ <> "Y" and alldigit$ <> "N"
PRINT "Press Y or N"
alldigit$="":WHILE alldigit$="":alldigit$=UCASE$(INKEY$):WEND
WEND
Code: Select all
DO UNTIL alldigit$ = "y" or alldigit$ = "n"
CLS: PRINT "Do you want to use all digits? "
INPUT "Press y or n ", alldigit$
LOOP
Code: Select all
alldigit$ = LCASE$(alldigit$)
IF an$ <> "y" AND alldigit$ <> "n" THEN
PRINT " You entered "; alldigit$; " Please enter y or n"
END IF
Code: Select all
GOSUB Calculate
...
...
...
Calculate:
bla, bla, bla
'I want to quit the subroutine here, so:
IF I$ = "Y" THEN GOTO CalculateEnd 'instead of IF I$ = "Y" THEN GOTO XY
bla, bla, bla
...
CalculateEnd:
RETURN 'this is the end of the subroutine Calculate
Code: Select all
DEFINT A-Z
CONST False=0, True = NOT False, ScreenWidth= 640, ScreenHeight = 480
Declare Sub FloodFill(BYVAL X, BYVAL Y, BYVAL Col)
Screen 12
Circle(320,240),10,4
Print Fre(-1)
FloodFill 320,240,14
Print Fre(-1)
Sleep
SUB FloodFill(BYVAL X, BYVAL Y, BYVAL Col)
If Point(X,Y)>0 Then Exit Sub
Pset(X,Y),Col
FloodFill X+1,Y,Col
FloodFill X,Y+1,Col
FloodFill X-1,Y,Col
FloodFill X,Y-1,Col
End Sub